[PATCH] D81939: [deadargelim] Attach dbg info to the insert/extractvalue instructions
Djordje Todorovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 30 07:34:13 PDT 2020
djtodoro updated this revision to Diff 274464.
djtodoro retitled this revision from "[NOT FOR COMMIT] [deadargelim] Attach dbg info to the insert/extractvalue instructions" to "[deadargelim] Attach dbg info to the insert/extractvalue instructions".
djtodoro edited the summary of this revision.
djtodoro added reviewers: vsk, aprantl, probinson, dblaikie.
djtodoro set the repository for this revision to rG LLVM Github Monorepo.
djtodoro added a comment.
- Cover all the instructions
- Cover all the cases with the test
- Remove //[NOT FOR COMMIT]// part
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81939/new/
https://reviews.llvm.org/D81939
Files:
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/test/Transforms/DeadArgElim/multdeadretval.ll
Index: llvm/test/Transforms/DeadArgElim/multdeadretval.ll
===================================================================
--- llvm/test/Transforms/DeadArgElim/multdeadretval.ll
+++ llvm/test/Transforms/DeadArgElim/multdeadretval.ll
@@ -4,6 +4,12 @@
; any remaining dead stuff.
; RUN: opt < %s -deadargelim -instcombine -dce -S | not grep i16
+; RUN: opt < %s -enable-debugify=synthetic -deadargelim -S 2>&1 \
+; RUN: | FileCheck %s -check-prefix=DEBUG
+
+; Check that every instruction inserted by -deadargelim has a debug location.
+; DEBUG: CheckModuleDebugify: PASS
+
define internal {i16, i32} @test(i16 %DEADARG) {
%A = insertvalue {i16,i32} undef, i16 1, 0
%B = insertvalue {i16,i32} %A, i32 1001, 1
Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
===================================================================
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -967,16 +967,19 @@
for (unsigned Ri = 0; Ri != RetCount; ++Ri)
if (NewRetIdxs[Ri] != -1) {
Value *V;
- if (RetTypes.size() > 1)
+ if (RetTypes.size() > 1) {
// We are still returning a struct, so extract the value from our
// return value
V = ExtractValueInst::Create(NewCB, NewRetIdxs[Ri], "newret",
InsertPt);
- else
+ cast<Instruction>(V)->setDebugLoc(InsertPt->getDebugLoc());
+ } else {
// We are now returning a single element, so just insert that
V = NewCB;
+ }
// Insert the value at the old position
RetVal = InsertValueInst::Create(RetVal, V, Ri, "oldret", InsertPt);
+ cast<Instruction>(RetVal)->setDebugLoc(InsertPt->getDebugLoc());
}
// Now, replace all uses of the old call instruction with the return
// struct we built
@@ -1035,12 +1038,14 @@
if (NewRetIdxs[RetI] != -1) {
ExtractValueInst *EV =
ExtractValueInst::Create(OldRet, RetI, "oldret", RI);
+ EV->setDebugLoc(RI->getDebugLoc());
if (RetTypes.size() > 1) {
// We're still returning a struct, so reinsert the value into
// our new return value at the new index
RetVal = InsertValueInst::Create(RetVal, EV, NewRetIdxs[RetI],
"newret", RI);
+ cast<Instruction>(RetVal)->setDebugLoc(RI->getDebugLoc());
} else {
// We are now only returning a simple value, so just return the
// extracted value.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81939.274464.patch
Type: text/x-patch
Size: 2773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200630/f3418764/attachment.bin>
More information about the llvm-commits
mailing list