[PATCH] D80756: Preserve DbgLoc when DeadArgumentElimination rewrites a 'ret'.
Paul Robinson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 28 13:45:43 PDT 2020
probinson created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
probinson added reviewers: dblaikie, jmorse.
probinson added a project: debug-info.
Fixes PR46002.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80756
Files:
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll
Index: llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll
===================================================================
--- llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll
+++ llvm/test/Transforms/DeadArgElim/dbginfo-preserve-dbgloc.ll
@@ -63,6 +63,7 @@
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
}
Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
===================================================================
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -1056,7 +1056,8 @@
}
// 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80756.267020.patch
Type: text/x-patch
Size: 1145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/e6101433/attachment.bin>
More information about the llvm-commits
mailing list