[PATCH] D18443: [Verifier] Reject PHIs using definitions from own block.
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 26 16:38:15 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL264528: [Verifier] Reject PHIs using defs from own block. (authored by Meinersbur).
Changed prior to commit:
http://reviews.llvm.org/D18443?vs=51711&id=51723#toc
Repository:
rL LLVM
http://reviews.llvm.org/D18443
Files:
llvm/trunk/lib/IR/Verifier.cpp
llvm/trunk/test/Transforms/LoopVectorize/phi-hang.ll
llvm/trunk/test/Verifier/dominates.ll
Index: llvm/trunk/test/Verifier/dominates.ll
===================================================================
--- llvm/trunk/test/Verifier/dominates.ll
+++ llvm/trunk/test/Verifier/dominates.ll
@@ -55,3 +55,16 @@
; CHECK-NEXT: %y1 = add i32 %x, 1
; CHECK-NEXT: %y3 = phi i32 [ %y1, %bb0 ]
}
+
+define void @f5() {
+entry:
+ br label %next
+
+next:
+ %y = phi i32 [ 0, %entry ]
+ %x = phi i32 [ %y, %entry ]
+ ret void
+; CHECK: Instruction does not dominate all uses!
+; CHECK-NEXT: %y = phi i32 [ 0, %entry ]
+; CHECK-NEXT: %x = phi i32 [ %y, %entry ]
+}
Index: llvm/trunk/test/Transforms/LoopVectorize/phi-hang.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopVectorize/phi-hang.ll
+++ llvm/trunk/test/Transforms/LoopVectorize/phi-hang.ll
@@ -18,7 +18,7 @@
bb5: ; preds = %bb4, %bb1
%tmp6 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ]
- %tmp7 = phi i32 [ 0, %bb4 ], [ %tmp6, %bb1 ]
+ %tmp7 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ]
%tmp8 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ]
%tmp9 = add nsw i32 %tmp2, 1
%tmp10 = icmp eq i32 %tmp9, 0
Index: llvm/trunk/lib/IR/Verifier.cpp
===================================================================
--- llvm/trunk/lib/IR/Verifier.cpp
+++ llvm/trunk/lib/IR/Verifier.cpp
@@ -3397,8 +3397,14 @@
return;
}
+ // Quick check whether the def has already been encountered in the same block.
+ // PHI nodes are not checked to prevent accepting preceeding PHIs, because PHI
+ // uses are defined to happen on the incoming edge, not at the instruction.
+ if (!isa<PHINode>(I) && InstsInThisBlock.count(Op))
+ return;
+
const Use &U = I.getOperandUse(i);
- Assert(InstsInThisBlock.count(Op) || DT.dominates(Op, U),
+ Assert(DT.dominates(Op, U),
"Instruction does not dominate all uses!", Op, &I);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18443.51723.patch
Type: text/x-patch
Size: 1889 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160326/ea84cbc5/attachment.bin>
More information about the llvm-commits
mailing list