forked from OSchip/llvm-project
Preserve DbgLoc when DeadArgumentElimination rewrites a 'ret'.
Fixes PR46002.
This commit is contained in:
parent
a01c0049b1
commit
8c2d2d971b
|
@ -1056,7 +1056,8 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
|
|||
}
|
||||
// Replace the return instruction with one returning the new return
|
||||
// value (possibly 0 if we became void).
|
||||
ReturnInst::Create(F->getContext(), RetVal, RI);
|
||||
auto *NewRet = ReturnInst::Create(F->getContext(), RetVal, RI);
|
||||
NewRet->setDebugLoc(RI->getDebugLoc());
|
||||
BB.getInstList().erase(RI);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ if.end3: ; preds = %if.end
|
|||
|
||||
cleanup: ; preds = %if.end3, %if.then2, %if.then
|
||||
%retval.0 = phi i1 [ false, %if.then2 ], [ true, %if.end3 ], [ false, %if.then ]
|
||||
; CHECK: ret void, !dbg
|
||||
ret i1 %retval.0, !dbg !56
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue