Skip to content

Commit 53fa6ed

Browse files
fixup! repond to @artagnon initial set of review
1 parent 073fd60 commit 53fa6ed

File tree

6 files changed

+43
-43
lines changed

6 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
@@ -3987,19 +3987,6 @@ class VPlanSlp {
39873987
bool isCompletelySLP() const { return CompletelySLP; }
39883988
};
39893989

3990-
namespace vputils {
3991-
3992-
/// Returns true for PHI-like recipes.
3993-
bool isPhi(const VPRecipeBase &R);
3994-
3995-
/// Returns true for PHI-like recipes that generate their own backedge
3996-
bool isPhiThatGeneratesBackedge(const VPRecipeBase &R);
3997-
3998-
/// Returns true for PHI-like recipes that exists in vector loop header basic
3999-
/// block
4000-
bool isHeaderPhi(const VPRecipeBase &R);
4001-
} // end namespace vputils
4002-
40033990
} // end namespace llvm
40043991

40053992
#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
@@ -3412,29 +3412,3 @@ void VPEVLBasedIVPHIRecipe::print(raw_ostream &O, const Twine &Indent,
34123412
}
34133413
#endif
34143414

3415-
bool vputils::isPhi(const VPRecipeBase &R) {
3416-
if (R.isPhi())
3417-
return true;
3418-
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
3419-
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
3420-
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
3421-
return false;
3422-
}
3423-
3424-
bool vputils::isPhiThatGeneratesBackedge(const VPRecipeBase &R) {
3425-
if (isa<VPWidenPHIRecipe, VPCSAHeaderPHIRecipe>(&R))
3426-
return true;
3427-
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
3428-
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
3429-
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
3430-
return false;
3431-
}
3432-
3433-
bool vputils::isHeaderPhi(const VPRecipeBase &R) {
3434-
if (isa<VPHeaderPHIRecipe, VPWidenPHIRecipe>(&R))
3435-
return true;
3436-
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
3437-
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
3438-
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
3439-
return false;
3440-
}

llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,30 @@ 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+
bool vputils::isPhi(const VPRecipeBase &R) {
65+
if (R.isPhi())
66+
return true;
67+
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
68+
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
69+
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
70+
return false;
71+
}
72+
73+
bool vputils::isPhiThatGeneratesBackedge(const VPRecipeBase &R) {
74+
if (isa<VPWidenPHIRecipe, VPCSAHeaderPHIRecipe>(&R))
75+
return true;
76+
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
77+
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
78+
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
79+
return false;
80+
}
81+
82+
bool vputils::isHeaderPhi(const VPRecipeBase &R) {
83+
if (isa<VPHeaderPHIRecipe, VPWidenPHIRecipe>(&R))
84+
return true;
85+
if (auto *VPInst = dyn_cast<VPInstruction>(&R))
86+
return VPInst->getOpcode() == VPInstruction::CSAMaskPhi ||
87+
VPInst->getOpcode() == VPInstruction::CSAVLPhi;
88+
return false;
89+
}

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/lib/Transforms/Vectorize/VPlanVerifier.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "VPlanVerifier.h"
1616
#include "VPlan.h"
1717
#include "VPlanCFG.h"
18+
#include "VPlanUtils.h"
1819
#include "VPlanDominatorTree.h"
1920
#include "llvm/ADT/DepthFirstIterator.h"
2021
#include "llvm/ADT/SmallPtrSet.h"

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)