Index: lib/IR/Verifier.cpp =================================================================== --- lib/IR/Verifier.cpp +++ lib/IR/Verifier.cpp @@ -3398,8 +3398,12 @@ } const Use &U = I.getOperandUse(i); - Assert(InstsInThisBlock.count(Op) || DT.dominates(Op, U), - "Instruction does not dominate all uses!", Op, &I); + if (isa(I)) + Assert(DT.dominates(Op, U), + "Instruction does not dominate PHI node's incoming edge!", Op, &I); + else + Assert(InstsInThisBlock.count(Op) || DT.dominates(Op, U), + "Instruction does not dominate all uses!", Op, &I); } void Verifier::visitDereferenceableMetadata(Instruction& I, MDNode* MD) { Index: test/Transforms/LoopVectorize/phi-hang.ll =================================================================== --- test/Transforms/LoopVectorize/phi-hang.ll +++ test/Transforms/LoopVectorize/phi-hang.ll @@ -1,33 +1,5 @@ ; RUN: opt -S -loop-vectorize < %s -; PR15384 -define void @test1(i32 %arg) { -bb: - br label %bb1 - -bb1: ; preds = %bb5, %bb - %tmp = phi i32 [ 1, %bb ], [ %tmp7, %bb5 ] - %tmp2 = phi i32 [ %arg, %bb ], [ %tmp9, %bb5 ] - br i1 true, label %bb5, label %bb3 - -bb3: ; preds = %bb1 - br label %bb4 - -bb4: ; preds = %bb3 - br label %bb5 - -bb5: ; preds = %bb4, %bb1 - %tmp6 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ] - %tmp7 = phi i32 [ 0, %bb4 ], [ %tmp6, %bb1 ] - %tmp8 = phi i32 [ 0, %bb4 ], [ %tmp, %bb1 ] - %tmp9 = add nsw i32 %tmp2, 1 - %tmp10 = icmp eq i32 %tmp9, 0 - br i1 %tmp10, label %bb11, label %bb1 - -bb11: ; preds = %bb5 - ret void -} - ; PR15748 define void @test2() { bb: Index: test/Verifier/dominates.ll =================================================================== --- test/Verifier/dominates.ll +++ test/Verifier/dominates.ll @@ -20,7 +20,7 @@ %y3 = landingpad i32 cleanup ret void -; CHECK: Instruction does not dominate all uses! +; CHECK: Instruction does not dominate PHI node's incoming edge! ; CHECK-NEXT: %y1 = invoke i32 @g() ; CHECK-NEXT: to label %bb1 unwind label %bb2 ; CHECK-NEXT: %y2 = phi i32 [ %y1, %bb0 ] @@ -38,7 +38,7 @@ bb3: %y3 = phi i32 [%y1, %bb2] ret void -; CHECK: Instruction does not dominate all uses! +; CHECK: Instruction does not dominate PHI node's incoming edge! ; CHECK-NEXT: %y1 = invoke i32 @g() ; CHECK-NEXT: to label %bb1 unwind label %bb2 ; CHECK-NEXT: %y3 = phi i32 [ %y1, %bb2 ] @@ -51,7 +51,20 @@ %y3 = phi i32 [%y1, %bb0] %y1 = add i32 %x, 1 ret void -; CHECK: Instruction does not dominate all uses! +; CHECK: Instruction does not dominate PHI node's incoming edge! ; 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 PHI node's incoming edge! +; CHECK-NEXT: %y = phi i32 [ 0, %entry ] +; CHECK-NEXT: %x = phi i32 [ %y, %entry ] +}