Skip to content

Commit f64e457

Browse files
author
Pierre-vh
committed
[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
1 parent 00072c0 commit f64e457

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

llvm/lib/Transforms/Utils/Debugify.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ bool checkDebugifyMetadata(Module &M,
233233

234234
// Find missing lines.
235235
for (Instruction &I : instructions(F)) {
236-
if (isa<DbgValueInst>(&I))
236+
if (isa<DbgValueInst>(&I) || isa<PHINode>(&I))
237237
continue;
238238

239239
auto DL = I.getDebugLoc();

llvm/test/DebugInfo/pr37964.ll

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
; RUN: opt -disable-output -debugify-each -gvn < %s 2>&1 | FileCheck %s
2+
3+
; CHECK-NOT: ERROR: Instruction with empty DebugLoc in function _Z3bazv -- {{%.*}} = phi
4+
; CHECK: CheckFunctionDebugify [Global Value Numbering]: PASS
5+
6+
@foo = dso_local local_unnamed_addr global i32 0, align 4
7+
@x = global i8 17
8+
9+
define dso_local void @_Z3bazv() local_unnamed_addr #0 {
10+
entry:
11+
br label %for.cond
12+
13+
for.cond.loopexit.loopexit: ; preds = %for.inc
14+
br label %for.cond.loopexit
15+
16+
for.cond.loopexit: ; preds = %for.cond.loopexit.loopexit, %for.cond
17+
br label %for.cond
18+
19+
for.cond: ; preds = %for.cond.loopexit, %entry
20+
%.pr = load i32, i32* @foo, align 4
21+
%tobool1 = icmp eq i32 %.pr, 0
22+
br i1 %tobool1, label %for.cond.loopexit, label %for.inc.preheader
23+
24+
for.inc.preheader: ; preds = %for.cond
25+
br label %for.inc
26+
27+
for.inc: ; preds = %for.inc.preheader, %for.inc
28+
%val = load i8, i8* @x
29+
%conv = sext i8 %val to i32
30+
store i32 %conv, i32* @foo, align 4
31+
%tobool = icmp eq i8 %val, 0
32+
br i1 %tobool, label %for.cond.loopexit.loopexit, label %for.inc
33+
}
34+
35+
declare dso_local signext i8 @_Z3barv() local_unnamed_addr #1

0 commit comments

Comments
 (0)