@@ -79,7 +79,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
79
79
per_local_var_debug_info : Option < IndexVec < mir:: Local , Vec < & ' tcx mir:: VarDebugInfo < ' tcx > > > > ,
80
80
81
81
/// Caller location propagated if this function has `#[track_caller]`.
82
- caller_location : Option < PlaceRef < ' tcx , Bx :: Value > > ,
82
+ caller_location : Option < OperandRef < ' tcx , Bx :: Value > > ,
83
83
}
84
84
85
85
impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
@@ -434,10 +434,17 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
434
434
fx. fn_abi. args. len( ) , args. len( ) + 1 ,
435
435
"#[track_caller] fn's must have 1 more argument in their ABI than in their MIR" ,
436
436
) ;
437
+
437
438
let arg = & fx. fn_abi . args . last ( ) . unwrap ( ) ;
438
- let place = PlaceRef :: alloca ( bx, arg. layout ) ;
439
- bx. store_fn_arg ( arg, & mut llarg_idx, place) ;
440
- fx. caller_location = Some ( place) ;
439
+ match arg. mode {
440
+ PassMode :: Direct ( _) => ( ) ,
441
+ _ => panic ! ( "caller location must be PassMode::Direct, found {:?}" , arg. mode) ,
442
+ }
443
+
444
+ fx. caller_location = Some ( OperandRef {
445
+ val : OperandValue :: Immediate ( bx. get_param ( llarg_idx) ) ,
446
+ layout : arg. layout ,
447
+ } ) ;
441
448
}
442
449
443
450
args
0 commit comments