@@ -79,7 +79,7 @@ pub struct FunctionCx<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
7979 per_local_var_debug_info : Option < IndexVec < mir:: Local , Vec < & ' tcx mir:: VarDebugInfo < ' tcx > > > > ,
8080
8181 /// 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 > > ,
8383}
8484
8585impl < ' a , ' tcx , Bx : BuilderMethods < ' a , ' tcx > > FunctionCx < ' a , ' tcx , Bx > {
@@ -434,10 +434,17 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
434434 fx. fn_abi. args. len( ) , args. len( ) + 1 ,
435435 "#[track_caller] fn's must have 1 more argument in their ABI than in their MIR" ,
436436 ) ;
437+
437438 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+ } ) ;
441448 }
442449
443450 args
0 commit comments