Skip to content

Commit 51e4c67

Browse files
fixup! repond to @artagnon initial set of review
1 parent dba2a22 commit 51e4c67

File tree

5 files changed

+43
-43
lines changed

5 files changed

+43
-43
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3983,19 +3983,6 @@ class VPlanSlp {
39833983
bool isCompletelySLP() const { return CompletelySLP; }
39843984
};
39853985

3986-
namespace vputils {
3987-
3988-
/// Returns true for PHI-like recipes.
3989-
bool isPhi(const VPRecipeBase &R);
3990-
3991-
/// Returns true for PHI-like recipes that generate their own backedge
3992-
bool isPhiThatGeneratesBackedge(const VPRecipeBase &R);
3993-
3994-
/// Returns true for PHI-like recipes that exists in vector loop header basic
3995-
/// block
3996-
bool isHeaderPhi(const VPRecipeBase &R);
3997-
} // end namespace vputils
3998-
39993986
} // end namespace llvm
40003987

40013988
#endif // LLVM_TRANSFORMS_VECTORIZE_VPLAN_H

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3360,29 +3360,3 @@ void VPEVLBasedIVPHIRecipe::print(raw_ostream &O, const Twine &Indent,
33603360
}
33613361
#endif
33623362

3363-
bool vputils::isPhi(const VPRecipeBase &R) {
3364-
if (R.isPhi())
3365-
return true;
3366-
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
3367-
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
3368-
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
3369-
return false;
3370-
}
3371-
3372-
bool vputils::isPhiThatGeneratesBackedge(const VPRecipeBase &R) {
3373-
if (isa<VPWidenPHIRecipe, VPCSAHeaderPHIRecipe>(&R))
3374-
return true;
3375-
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
3376-
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
3377-
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
3378-
return false;
3379-
}
3380-
3381-
bool vputils::isHeaderPhi(const VPRecipeBase &R) {
3382-
if (isa<VPHeaderPHIRecipe, VPWidenPHIRecipe>(&R))
3383-
return true;
3384-
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
3385-
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
3386-
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
3387-
return false;
3388-
}

llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,31 @@ bool vputils::isHeaderMask(const VPValue *V, VPlan &Plan) {
6060
return match(V, m_Binary<Instruction::ICmp>(m_VPValue(A), m_VPValue(B))) &&
6161
IsWideCanonicalIV(A) && B == Plan.getOrCreateBackedgeTakenCount();
6262
}
63+
64+
65+
bool vputils::isPhi(const VPRecipeBase &R) {
66+
if (R.isPhi())
67+
return true;
68+
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
69+
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
70+
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
71+
return false;
72+
}
73+
74+
bool vputils::isPhiThatGeneratesBackedge(const VPRecipeBase &R) {
75+
if (isa<VPWidenPHIRecipe, VPCSAHeaderPHIRecipe>(&R))
76+
return true;
77+
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
78+
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
79+
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
80+
return false;
81+
}
82+
83+
bool vputils::isHeaderPhi(const VPRecipeBase &R) {
84+
if (isa<VPHeaderPHIRecipe, VPWidenPHIRecipe>(&R))
85+
return true;
86+
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
87+
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
88+
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
89+
return false;
90+
}

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ inline bool isUniformAfterVectorization(const VPValue *VPV) {
4545

4646
/// Return true if \p V is a header mask in \p Plan.
4747
bool isHeaderMask(const VPValue *V, VPlan &Plan);
48+
49+
/// Returns true for PHI-like recipes.
50+
bool isPhi(const VPRecipeBase &R);
51+
52+
/// Returns true for PHI-like recipes that generate their own backedge
53+
bool isPhiThatGeneratesBackedge(const VPRecipeBase &R);
54+
55+
/// Returns true for PHI-like recipes that exists in vector loop header basic
56+
/// block
57+
bool isHeaderPhi(const VPRecipeBase &R);
58+
4859
} // end namespace llvm::vputils
4960

5061
#endif

llvm/test/Transforms/LoopVectorize/RISCV/csa.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ for.body: ; preds = %for.body.preheader,
259259
}
260260

261261
; This function is generated from the following C/C++ program:
262-
; int simple_csa_int_select(int N, int *data) {
262+
; int simple_csa_int_select_induction_cmp(int N, int *data) {
263263
; int t = -1;
264264
; for (int i = 0; i < N; i++) {
265265
; if (i < data[i])
@@ -1373,13 +1373,13 @@ for.body: ; preds = %for.body.preheader,
13731373
}
13741374

13751375
; This function is generated from the following C/C++ program:
1376-
; int csa_in_series_int_select(int N, int *data0, int *data1) {
1376+
; int csa_in_series_int_select_induction_cmp(int N, int *data0, int *data1) {
13771377
; int t = -1;
13781378
; int s = -1;
13791379
; for (int i = 0; i < N; i++) {
1380-
; if (a < data0[i])
1380+
; if (i < data0[i])
13811381
; t = data0[i];
1382-
; if (a < data1[i])
1382+
; if (i < data1[i])
13831383
; s = data1[i];
13841384
; }
13851385
; return t | s; // use t and s

0 commit comments

Comments
 (0)