[PATCH] D44356: [LICM] Salvage DebugInfo from dying Instructions
Anastasis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 10 14:13:34 PST 2018
gramanas created this revision.
gramanas added a reviewer: vsk.
Herald added subscribers: llvm-commits, JDevlieghere.
Simmilar to https://github.com/llvm-mirror/llvm/commit/fd30c2ddf8cc0fe95717977468b16ce1afac6aef , `salvageDebugInfo()` is called before this pass (LICM) erases an instruction.
Repository:
rL LLVM
https://reviews.llvm.org/D44356
Files:
lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/2011-04-09-RAUW-AST.ll
test/Transforms/LICM/sinking.ll
Index: test/Transforms/LICM/sinking.ll
===================================================================
--- test/Transforms/LICM/sinking.ll
+++ test/Transforms/LICM/sinking.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -basicaa -licm -S | FileCheck %s
+; RUN: opt < %s -debugify -basicaa -licm -S | FileCheck %s -check-prefix=DEBUGIFY
declare i32 @strlen(i8*) readonly nounwind
@@ -306,10 +307,12 @@
exit:
%lcssa = phi i32 [ %l, %l4.latch ], [ %l, %l4.body ]
; CHECK-LABEL: @PR18753(
+; DEBUGIFY-LABEL: @PR18753(
; CHECK: exit:
; CHECK-NEXT: %[[LCSSAPHI:.*]] = phi i64 [ %iv, %l4.latch ], [ %iv, %l4.body ]
; CHECK-NEXT: %l.le = trunc i64 %[[LCSSAPHI]] to i32
-; CHECK-NEXT: ret i32 %l.le
+; DEBUGIFY: call void @llvm.dbg.value(metadata i32 %l.le, metadata !143, metadata !DIExpression())
+; CHECK: ret i32 %l.le
ret i32 %lcssa
}
Index: test/Transforms/LICM/2011-04-09-RAUW-AST.ll
===================================================================
--- test/Transforms/LICM/2011-04-09-RAUW-AST.ll
+++ test/Transforms/LICM/2011-04-09-RAUW-AST.ll
@@ -1,4 +1,5 @@
; RUN: opt < %s -loop-rotate -licm -S | FileCheck %s
+; RUN: opt < %s -debugify -loop-rotate -licm -S | FileCheck %s -check-prefix=DEBUGIFY
; PR9604
@g_3 = global i32 0, align 4
@@ -26,7 +27,8 @@
; CHECK: for.body7:
; CHECK-NEXT: phi
-; CHECK-NEXT: store i32 0
+; DEBUGIFY: call void @llvm.dbg.value(metadata i32 %y.01, metadata !16, metadata !DIExpression())
+; CHECK: store i32 0
; CHECK-NEXT: store i32 1
for.body7: ; preds = %for.cond4
Index: lib/Transforms/Scalar/LICM.cpp
===================================================================
--- lib/Transforms/Scalar/LICM.cpp
+++ lib/Transforms/Scalar/LICM.cpp
@@ -393,6 +393,7 @@
// used in the loop, instead, just delete it.
if (isInstructionTriviallyDead(&I, TLI)) {
DEBUG(dbgs() << "LICM deleting dead inst: " << I << '\n');
+ salvageDebugInfo(I);
++II;
CurAST->deleteValue(&I);
I.eraseFromParent();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44356.137928.patch
Type: text/x-patch
Size: 2062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180310/24bebc86/attachment.bin>
More information about the llvm-commits
mailing list