Skip to content

Commit d47582a

Browse files
committed
Address review comments
- Move `setStepValue` to `VPWidenInductionRecipe` - Make `simplifyBranchConditionForVFAndUF` a static, non-member function - Update a lit test
1 parent e2bead5 commit d47582a

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,6 +1726,9 @@ class VPWidenInductionRecipe : public VPHeaderPHIRecipe {
17261726
VPValue *getStepValue() { return getOperand(1); }
17271727
const VPValue *getStepValue() const { return getOperand(1); }
17281728

1729+
/// Update the step value of the recipe.
1730+
void setStepValue(VPValue *V) { setOperand(1, V); }
1731+
17291732
PHINode *getPHINode() const { return cast<PHINode>(getUnderlyingValue()); }
17301733

17311734
/// Returns the induction descriptor for the recipe.
@@ -1800,9 +1803,6 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
18001803
VPSlotTracker &SlotTracker) const override;
18011804
#endif
18021805

1803-
/// Update the step value of the recipe.
1804-
void setStepValue(VPValue *V) { setOperand(1, V); }
1805-
18061806
VPValue *getVFValue() { return getOperand(2); }
18071807
const VPValue *getVFValue() const { return getOperand(2); }
18081808

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,11 @@ static bool optimizeVectorInductionWidthForTCAndVFUF(VPlan &Plan,
10791079
return MadeChange;
10801080
}
10811081

1082-
bool VPlanTransforms::simplifyBranchConditionForVFAndUF(
1083-
VPlan &Plan, ElementCount BestVF, unsigned BestUF,
1084-
PredicatedScalarEvolution &PSE) {
1082+
/// Try to simplify the branch condition of \p Plan. This may restrict the
1083+
/// resulting plan to \p BestVF and \p BestUF.
1084+
static bool simplifyBranchConditionForVFAndUF(VPlan &Plan, ElementCount BestVF,
1085+
unsigned BestUF,
1086+
PredicatedScalarEvolution &PSE) {
10851087
VPRegionBlock *VectorRegion = Plan.getVectorLoopRegion();
10861088
VPBasicBlock *ExitingVPBB = VectorRegion->getExitingBasicBlock();
10871089
auto *Term = &ExitingVPBB->back();
@@ -1131,7 +1133,7 @@ bool VPlanTransforms::simplifyBranchConditionForVFAndUF(
11311133

11321134
VPBlockUtils::connectBlocks(Preheader, Header);
11331135
VPBlockUtils::connectBlocks(ExitingVPBB, Exit);
1134-
simplifyRecipes(Plan, *CanIVTy);
1136+
VPlanTransforms::simplifyRecipes(Plan, *CanIVTy);
11351137
} else {
11361138
// The vector region contains header phis for which we cannot remove the
11371139
// loop region yet.

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,6 @@ struct VPlanTransforms {
9797
unsigned BestUF,
9898
PredicatedScalarEvolution &PSE);
9999

100-
/// Try to simplify the branch condition of \p Plan. This may restrict the
101-
/// resulting plan to \p BestVF and \p BestUF.
102-
static bool simplifyBranchConditionForVFAndUF(VPlan &Plan,
103-
ElementCount BestVF,
104-
unsigned BestUF,
105-
PredicatedScalarEvolution &PSE);
106-
107100
/// Apply VPlan-to-VPlan optimizations to \p Plan, including induction recipe
108101
/// optimizations, dead recipe removal, replicate region optimizations and
109102
/// block merging.

llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory-remove-loop-region.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ define void @load_store_interleave_group_tc_2(ptr noalias %data) {
5151
; VF4-NEXT: br label %[[VECTOR_BODY:.*]]
5252
; VF4: [[VECTOR_BODY]]:
5353
; VF4-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[PRED_STORE_CONTINUE6:.*]] ]
54-
; VF4-NEXT: [[VEC_IND:%.*]] = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[PRED_STORE_CONTINUE6]] ]
55-
; VF4-NEXT: [[TMP0:%.*]] = icmp ule <4 x i64> [[VEC_IND]], splat (i64 1)
54+
; VF4-NEXT: [[VEC_IND:%.*]] = phi <4 x i8> [ <i8 0, i8 1, i8 2, i8 3>, %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[PRED_STORE_CONTINUE6]] ]
55+
; VF4-NEXT: [[TMP0:%.*]] = icmp ule <4 x i8> [[VEC_IND]], splat (i8 1)
5656
; VF4-NEXT: [[TMP1:%.*]] = extractelement <4 x i1> [[TMP0]], i32 0
5757
; VF4-NEXT: br i1 [[TMP1]], label %[[PRED_STORE_IF:.*]], label %[[PRED_STORE_CONTINUE:.*]]
5858
; VF4: [[PRED_STORE_IF]]:
@@ -109,7 +109,7 @@ define void @load_store_interleave_group_tc_2(ptr noalias %data) {
109109
; VF4-NEXT: store i64 [[TMP32]], ptr [[TMP31]], align 8
110110
; VF4-NEXT: br label %[[PRED_STORE_CONTINUE6]]
111111
; VF4: [[PRED_STORE_CONTINUE6]]:
112-
; VF4-NEXT: [[VEC_IND_NEXT]] = add <4 x i64> [[VEC_IND]], splat (i64 4)
112+
; VF4-NEXT: [[VEC_IND_NEXT]] = add <4 x i8> [[VEC_IND]], splat (i8 4)
113113
; VF4-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
114114
; VF4-NEXT: br i1 true, label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
115115
; VF4: [[MIDDLE_BLOCK]]:

0 commit comments

Comments
 (0)