[PATCH] D75242: [Transforms][Debugify] Ignore PHI nodes when checking for DebugLocs
Pierre van Houtryve via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 27 04:41:43 PST 2020
Pierre-vh created this revision.
Pierre-vh added reviewers: gbedwell, StephenTozer.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
This is a fix for https://bugs.llvm.org/show_bug.cgi?id=37964
According to the comments of this bug, Debugify should not care about PHI nodes. This changes makes it so Debugify ignores PHI nodes when checking for the presence of a DebugLoc.
I also added a regression test, though I'm not sure if it's in the right folder.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D75242
Files:
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/DebugInfo/pr37964.ll
Index: llvm/test/DebugInfo/pr37964.ll
===================================================================
--- /dev/null
+++ llvm/test/DebugInfo/pr37964.ll
@@ -0,0 +1,35 @@
+; RUN: opt -disable-output -debugify-each -gvn < %s 2>&1 | FileCheck %s
+
+; CHECK-NOT: ERROR: Instruction with empty DebugLoc in function _Z3bazv -- {{%.*}} = phi
+; CHECK: CheckFunctionDebugify [Global Value Numbering]: PASS
+
+ at foo = dso_local local_unnamed_addr global i32 0, align 4
+ at x = global i8 17
+
+define dso_local void @_Z3bazv() local_unnamed_addr #0 {
+entry:
+ br label %for.cond
+
+for.cond.loopexit.loopexit: ; preds = %for.inc
+ br label %for.cond.loopexit
+
+for.cond.loopexit: ; preds = %for.cond.loopexit.loopexit, %for.cond
+ br label %for.cond
+
+for.cond: ; preds = %for.cond.loopexit, %entry
+ %.pr = load i32, i32* @foo, align 4
+ %tobool1 = icmp eq i32 %.pr, 0
+ br i1 %tobool1, label %for.cond.loopexit, label %for.inc.preheader
+
+for.inc.preheader: ; preds = %for.cond
+ br label %for.inc
+
+for.inc: ; preds = %for.inc.preheader, %for.inc
+ %val = load i8, i8* @x
+ %conv = sext i8 %val to i32
+ store i32 %conv, i32* @foo, align 4
+ %tobool = icmp eq i8 %val, 0
+ br i1 %tobool, label %for.cond.loopexit.loopexit, label %for.inc
+}
+
+declare dso_local signext i8 @_Z3barv() local_unnamed_addr #1
Index: llvm/lib/Transforms/Utils/Debugify.cpp
===================================================================
--- llvm/lib/Transforms/Utils/Debugify.cpp
+++ llvm/lib/Transforms/Utils/Debugify.cpp
@@ -233,7 +233,7 @@
// Find missing lines.
for (Instruction &I : instructions(F)) {
- if (isa<DbgValueInst>(&I))
+ if (isa<DbgValueInst>(&I) || isa<PHINode>(&I))
continue;
auto DL = I.getDebugLoc();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75242.246913.patch
Type: text/x-patch
Size: 1920 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200227/a3d78d1f/attachment.bin>
More information about the llvm-commits
mailing list