Skip to content

Commit 06de98a

Browse files
committed
!fixup address latest comments, thanks!
1 parent c77792e commit 06de98a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,9 +894,12 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
894894
match(NewBlend->getMask(1), m_Not(m_VPValue(NewMask)))) {
895895
VPValue *Inc0 = NewBlend->getIncomingValue(0);
896896
VPValue *Inc1 = NewBlend->getIncomingValue(1);
897+
VPValue *OldMask = NewBlend->getOperand(2);
897898
NewBlend->setOperand(0, Inc1);
898899
NewBlend->setOperand(1, Inc0);
899900
NewBlend->setOperand(2, NewMask);
901+
if (OldMask->getNumUsers() == 0)
902+
cast<VPInstruction>(OldMask)->eraseFromParent();
900903
}
901904
return;
902905
}

llvm/test/Transforms/LoopVectorize/if-conversion.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ define i32 @reduction_func(ptr nocapture %A, i32 %n) nounwind uwtable readonly s
159159
; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x i32> [ zeroinitializer, %[[VECTOR_PH]] ], [ [[PREDPHI:%.*]], %[[VECTOR_BODY]] ]
160160
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr [[A]], i64 [[INDEX]]
161161
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP1]], align 4
162-
; CHECK-NEXT: [[TMP2:%.*]] = icmp slt <4 x i32> [[WIDE_LOAD]], splat (i32 31)
162+
; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt <4 x i32> [[WIDE_LOAD]], splat (i32 30)
163163
; CHECK-NEXT: [[TMP3:%.*]] = add <4 x i32> [[VEC_PHI]], splat (i32 2)
164164
; CHECK-NEXT: [[TMP4:%.*]] = add <4 x i32> [[TMP3]], [[WIDE_LOAD]]
165-
; CHECK-NEXT: [[PREDPHI]] = select <4 x i1> [[TMP2]], <4 x i32> [[VEC_PHI]], <4 x i32> [[TMP4]]
165+
; CHECK-NEXT: [[PREDPHI]] = select <4 x i1> [[TMP2]], <4 x i32> [[TMP4]], <4 x i32> [[VEC_PHI]]
166166
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
167167
; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
168168
; CHECK-NEXT: br i1 [[TMP5]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP9:![0-9]+]]

0 commit comments

Comments
 (0)