Skip to content

Commit 6b0f436

Browse files
committed
!fixup address latest comments, thanks!
1 parent 112c494 commit 6b0f436

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -851,20 +851,8 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
851851
return;
852852
}
853853

854-
if (Blend->isNormalized()) {
855-
/// Simplify BLEND %a, %b, Not(%mask) -> BLEND %b, %a, %mask.
856-
VPValue *NewMask;
857-
if (Blend->getNumOperands() == 3 &&
858-
match(Blend->getMask(1), m_Not(m_VPValue(NewMask)))) {
859-
VPValue *Inc0 = Blend->getIncomingValue(0);
860-
VPValue *Inc1 = Blend->getIncomingValue(1);
861-
Blend->setOperand(0, Inc1);
862-
Blend->setOperand(1, Inc0);
863-
Blend->setOperand(2, NewMask);
864-
}
865-
854+
if (Blend->isNormalized())
866855
return;
867-
}
868856

869857
// Normalize the blend so its first incoming value is used as the initial
870858
// value with the others blended into it.
@@ -899,6 +887,17 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
899887
Blend->replaceAllUsesWith(NewBlend);
900888
Blend->eraseFromParent();
901889
recursivelyDeleteDeadRecipes(DeadMask);
890+
891+
/// Simplify BLEND %a, %b, Not(%mask) -> BLEND %b, %a, %mask.
892+
VPValue *NewMask;
893+
if (NewBlend->getNumOperands() == 3 &&
894+
match(NewBlend->getMask(1), m_Not(m_VPValue(NewMask)))) {
895+
VPValue *Inc0 = NewBlend->getIncomingValue(0);
896+
VPValue *Inc1 = NewBlend->getIncomingValue(1);
897+
NewBlend->setOperand(0, Inc1);
898+
NewBlend->setOperand(1, Inc0);
899+
NewBlend->setOperand(2, NewMask);
900+
}
902901
return;
903902
}
904903

llvm/test/Transforms/LoopVectorize/if-pred-stores.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ define void @bug18724(i1 %cond, ptr %ptr, i1 %cond.2, i64 %v.1, i32 %v.2) {
317317
; VEC-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[TMP4]], 2
318318
; VEC-NEXT: [[N_VEC:%.*]] = sub i64 [[TMP4]], [[N_MOD_VF]]
319319
; VEC-NEXT: [[IND_END:%.*]] = add i64 [[V_1]], [[N_VEC]]
320-
; VEC-NEXT: [[TMP5:%.*]] = insertelement <2 x i32> zeroinitializer, i32 [[V_2:%.*]], i32 0
321320
; VEC-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x i1> poison, i1 [[COND_2:%.*]], i64 0
322321
; VEC-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x i1> [[BROADCAST_SPLATINSERT]], <2 x i1> poison, <2 x i32> zeroinitializer
322+
; VEC-NEXT: [[TMP5:%.*]] = insertelement <2 x i32> zeroinitializer, i32 [[V_2:%.*]], i32 0
323323
; VEC-NEXT: br label [[VECTOR_BODY:%.*]]
324324
; VEC: vector.body:
325325
; VEC-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[PRED_STORE_CONTINUE2:%.*]] ]

llvm/test/Transforms/LoopVectorize/unused-blend-mask-for-first-operand.ll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@ define void @test_not_first_lane_only_wide_compare_incoming_order_swapped(ptr %A
168168
; CHECK-NEXT: entry:
169169
; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
170170
; CHECK: vector.ph:
171-
; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i16> poison, i16 [[X]], i64 0
172-
; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i16> [[BROADCAST_SPLATINSERT]], <4 x i16> poison, <4 x i32> zeroinitializer
173171
; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
174172
; CHECK: vector.body:
175173
; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
@@ -178,8 +176,8 @@ define void @test_not_first_lane_only_wide_compare_incoming_order_swapped(ptr %A
178176
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i16, ptr [[A]], i16 [[TMP0]]
179177
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i16, ptr [[TMP1]], i32 0
180178
; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i16>, ptr [[TMP2]], align 2
181-
; CHECK-NEXT: [[TMP3:%.*]] = icmp ult <4 x i16> [[WIDE_LOAD]], [[BROADCAST_SPLAT]]
182-
; CHECK-NEXT: [[TMP4:%.*]] = extractelement <4 x i1> [[TMP3]], i32 0
179+
; CHECK-NEXT: [[TMP3:%.*]] = extractelement <4 x i16> [[WIDE_LOAD]], i32 0
180+
; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i16 [[TMP3]], [[X]]
183181
; CHECK-NEXT: [[PREDPHI:%.*]] = select i1 [[TMP4]], ptr poison, ptr [[B]]
184182
; CHECK-NEXT: [[TMP12:%.*]] = load i16, ptr [[PREDPHI]], align 2
185183
; CHECK-NEXT: [[BROADCAST_SPLATINSERT3:%.*]] = insertelement <4 x i16> poison, i16 [[TMP12]], i64 0

0 commit comments

Comments
 (0)