@@ -3,9 +3,11 @@ use rustc_index::vec::IndexVec;
3
3
use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
4
4
use rustc_middle:: mir;
5
5
use rustc_middle:: ty;
6
+ use rustc_middle:: ty:: layout:: LayoutOf ;
6
7
use rustc_session:: config:: DebugInfo ;
7
8
use rustc_span:: symbol:: { kw, Symbol } ;
8
9
use rustc_span:: { BytePos , Span } ;
10
+ use rustc_target:: abi:: Abi ;
9
11
use rustc_target:: abi:: Size ;
10
12
11
13
use super :: operand:: { OperandRef , OperandValue } ;
@@ -368,21 +370,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
368
370
{
369
371
let arg_index = place. local . index ( ) - 1 ;
370
372
if target_is_msvc {
371
- // Rust compiler decomposes every &str or slice argument into two components:
372
- // a pointer to the memory address where the data is stored and a usize representing
373
- // the length of the str (or slice). These components will later be used to reconstruct
374
- // the original argument inside the body of the function that owns it (see the
375
- // definition of debug_introduce_local for more details).
376
- //
377
- // Since the original argument is declared inside a function rather than being passed
378
- // in as an argument, it must be marked as a LocalVariable for MSVC debuggers to visualize
379
- // its data correctly. (See issue #81894 for an in-depth description of the problem).
380
- match * var_ty. kind ( ) {
381
- ty:: Ref ( _, inner_type, _) => match * inner_type. kind ( ) {
382
- ty:: Slice ( _) | ty:: Str => VariableKind :: LocalVariable ,
383
- _ => VariableKind :: ArgumentVariable ( arg_index + 1 ) ,
384
- } ,
385
- _ => VariableKind :: ArgumentVariable ( arg_index + 1 ) ,
373
+ // ScalarPair parameters are spilled to the stack so they need to
374
+ // be marked as a `LocalVariable` for MSVC debuggers to visualize
375
+ // their data correctly. (See #81894 & #88625)
376
+ let var_ty_layout = self . cx . layout_of ( var_ty) ;
377
+ if let Abi :: ScalarPair ( _, _) = var_ty_layout. abi {
378
+ VariableKind :: LocalVariable
379
+ } else {
380
+ VariableKind :: ArgumentVariable ( arg_index + 1 )
386
381
}
387
382
} else {
388
383
// FIXME(eddyb) shouldn't `ArgumentVariable` indices be
0 commit comments