Skip to content

Commit 8a1b9ff

Browse files
committed
Recalculate VPDT in VPlan::execute
1 parent a76487a commit 8a1b9ff

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,10 @@ void VPlan::execute(VPTransformState *State) {
983983
State->CFG.PrevVPBB = nullptr;
984984
State->CFG.ExitBB = State->CFG.PrevBB->getSingleSuccessor();
985985

986+
// Update VPDominatorTree since VPBasicBlock may be removed after State wsa
987+
// constucted.
988+
State->VPDT->recalculate(*this);
989+
986990
// Disconnect VectorPreHeader from ExitBB in both the CFG and DT.
987991
BasicBlock *VectorPreHeader = State->CFG.PrevBB;
988992
cast<BranchInst>(VectorPreHeader->getTerminator())->setSuccessor(0, nullptr);

llvm/test/Transforms/LoopVectorize/X86/epilog-vectorization-inductions.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ define void @test_induction_step_needs_expansion(ptr noalias %j, ptr %k, i64 %l,
137137
; CHECK-LABEL: @test_induction_step_needs_expansion(
138138
; CHECK-NEXT: iter.check:
139139
; CHECK-NEXT: [[TMP0:%.*]] = sub i16 0, [[OFF:%.*]]
140-
; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <16 x i16> poison, i16 [[TMP0]], i64 0
141-
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <16 x i16> [[BROADCAST_SPLATINSERT]], <16 x i16> poison, <16 x i32> zeroinitializer
142140
; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[L:%.*]], 8
143141
; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[VEC_EPILOG_SCALAR_PH:%.*]], label [[VECTOR_MAIN_LOOP_ITER_CHECK:%.*]]
144142
; CHECK: vector.main.loop.iter.check:
@@ -149,6 +147,8 @@ define void @test_induction_step_needs_expansion(ptr noalias %j, ptr %k, i64 %l,
149147
; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 [[L]], [[N_MOD_VF]]
150148
; CHECK-NEXT: [[DOTCAST:%.*]] = trunc i64 [[N_VEC]] to i16
151149
; CHECK-NEXT: [[IND_END:%.*]] = mul i16 [[DOTCAST]], [[TMP0]]
150+
; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <16 x i16> poison, i16 [[TMP0]], i64 0
151+
; CHECK-NEXT: [[TMP2:%.*]] = shufflevector <16 x i16> [[BROADCAST_SPLATINSERT]], <16 x i16> poison, <16 x i32> zeroinitializer
152152
; CHECK-NEXT: [[TMP1:%.*]] = mul <16 x i16> splat (i16 16), [[TMP2]]
153153
; CHECK-NEXT: [[DOTSPLATINSERT:%.*]] = insertelement <16 x i16> poison, i16 [[TMP0]], i64 0
154154
; CHECK-NEXT: [[DOTSPLAT:%.*]] = shufflevector <16 x i16> [[DOTSPLATINSERT]], <16 x i16> poison, <16 x i32> zeroinitializer

0 commit comments

Comments
 (0)