[llvm] f64e457 - [Transforms][Debugify] Ignore PHI nodes when checking for DebugLocs

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 08:15:11 PST 2020


Author: Pierre-vh
Date: 2020-02-27T16:14:11Z
New Revision: f64e457cb75b61f6566de8327a1bfae498d5a296

URL: https://github.com/llvm/llvm-project/commit/f64e457cb75b61f6566de8327a1bfae498d5a296
DIFF: https://github.com/llvm/llvm-project/commit/f64e457cb75b61f6566de8327a1bfae498d5a296.diff

LOG: [Transforms][Debugify] Ignore PHI nodes when checking for DebugLocs

Fix for: https://bugs.llvm.org/show_bug.cgi?id=37964

Differential Revision: https://reviews.llvm.org/D75242

Added: 
    llvm/test/DebugInfo/pr37964.ll

Modified: 
    llvm/lib/Transforms/Utils/Debugify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index b7b4bfa3734d..b1274d948e88 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -233,7 +233,7 @@ bool checkDebugifyMetadata(Module &M,
 
     // Find missing lines.
     for (Instruction &I : instructions(F)) {
-      if (isa<DbgValueInst>(&I))
+      if (isa<DbgValueInst>(&I) || isa<PHINode>(&I))
         continue;
 
       auto DL = I.getDebugLoc();

diff  --git a/llvm/test/DebugInfo/pr37964.ll b/llvm/test/DebugInfo/pr37964.ll
new file mode 100644
index 000000000000..e95297550eb3
--- /dev/null
+++ b/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


        


More information about the llvm-commits mailing list