mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[VPlan] Add VPReductionSC to VPUser::classof, unify VPValue IDs.
This is a follow-up to 00a66011366c7b037d6680e6015524a41b761c34 to make isa<VPReductionRecipe> work and unifies the VPValue ID names, by making sure they all consistently start with VPV*.
This commit is contained in:
parent
806b8f5c8d
commit
454f327b71
@ -726,6 +726,7 @@ inline bool VPUser::classof(const VPRecipeBase *Recipe) {
|
||||
Recipe->getVPRecipeID() == VPRecipeBase::VPBlendSC ||
|
||||
Recipe->getVPRecipeID() == VPRecipeBase::VPInterleaveSC ||
|
||||
Recipe->getVPRecipeID() == VPRecipeBase::VPReplicateSC ||
|
||||
Recipe->getVPRecipeID() == VPRecipeBase::VPReductionSC ||
|
||||
Recipe->getVPRecipeID() == VPRecipeBase::VPBranchOnMaskSC ||
|
||||
Recipe->getVPRecipeID() == VPRecipeBase::VPWidenMemoryInstructionSC;
|
||||
}
|
||||
@ -760,7 +761,7 @@ protected:
|
||||
|
||||
public:
|
||||
VPInstruction(unsigned Opcode, ArrayRef<VPValue *> Operands)
|
||||
: VPUser(Operands), VPValue(VPValue::VPInstructionSC),
|
||||
: VPUser(Operands), VPValue(VPValue::VPVInstructionSC),
|
||||
VPRecipeBase(VPRecipeBase::VPInstructionSC), Opcode(Opcode) {}
|
||||
|
||||
VPInstruction(unsigned Opcode, std::initializer_list<VPValue *> Operands)
|
||||
@ -768,7 +769,7 @@ public:
|
||||
|
||||
/// Method to support type inquiry through isa, cast, and dyn_cast.
|
||||
static inline bool classof(const VPValue *V) {
|
||||
return V->getVPValueID() == VPValue::VPInstructionSC;
|
||||
return V->getVPValueID() == VPValue::VPVInstructionSC;
|
||||
}
|
||||
|
||||
VPInstruction *clone() const {
|
||||
@ -832,7 +833,7 @@ class VPWidenRecipe : public VPRecipeBase, public VPValue, public VPUser {
|
||||
public:
|
||||
template <typename IterT>
|
||||
VPWidenRecipe(Instruction &I, iterator_range<IterT> Operands)
|
||||
: VPRecipeBase(VPRecipeBase::VPWidenSC), VPValue(VPValue::VPWidenSC, &I),
|
||||
: VPRecipeBase(VPRecipeBase::VPWidenSC), VPValue(VPValue::VPVWidenSC, &I),
|
||||
VPUser(Operands) {}
|
||||
|
||||
~VPWidenRecipe() override = default;
|
||||
@ -842,7 +843,7 @@ public:
|
||||
return V->getVPRecipeID() == VPRecipeBase::VPWidenSC;
|
||||
}
|
||||
static inline bool classof(const VPValue *V) {
|
||||
return V->getVPValueID() == VPValue::VPWidenSC;
|
||||
return V->getVPValueID() == VPValue::VPVWidenSC;
|
||||
}
|
||||
|
||||
/// Produce widened copies of all Ingredients.
|
||||
@ -1086,7 +1087,7 @@ public:
|
||||
VPValue *VecOp, VPValue *CondOp, bool NoNaN,
|
||||
const TargetTransformInfo *TTI)
|
||||
: VPRecipeBase(VPRecipeBase::VPReductionSC),
|
||||
VPValue(VPValue::VPReductionSC, I), VPUser({ChainOp, VecOp}),
|
||||
VPValue(VPValue::VPVReductionSC, I), VPUser({ChainOp, VecOp}),
|
||||
RdxDesc(R), NoNaN(NoNaN), TTI(TTI) {
|
||||
if (CondOp)
|
||||
addOperand(CondOp);
|
||||
@ -1096,7 +1097,7 @@ public:
|
||||
|
||||
/// Method to support type inquiry through isa, cast, and dyn_cast.
|
||||
static inline bool classof(const VPValue *V) {
|
||||
return V->getVPValueID() == VPValue::VPReductionSC;
|
||||
return V->getVPValueID() == VPValue::VPVReductionSC;
|
||||
}
|
||||
static inline bool classof(const VPRecipeBase *V) {
|
||||
return V->getVPRecipeID() == VPRecipeBase::VPReductionSC;
|
||||
@ -1257,14 +1258,14 @@ class VPWidenMemoryInstructionRecipe : public VPRecipeBase,
|
||||
public:
|
||||
VPWidenMemoryInstructionRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask)
|
||||
: VPRecipeBase(VPWidenMemoryInstructionSC),
|
||||
VPValue(VPValue::VPMemoryInstructionSC, &Load), VPUser({Addr}) {
|
||||
VPValue(VPValue::VPVMemoryInstructionSC, &Load), VPUser({Addr}) {
|
||||
setMask(Mask);
|
||||
}
|
||||
|
||||
VPWidenMemoryInstructionRecipe(StoreInst &Store, VPValue *Addr,
|
||||
VPValue *StoredValue, VPValue *Mask)
|
||||
: VPRecipeBase(VPWidenMemoryInstructionSC),
|
||||
VPValue(VPValue::VPMemoryInstructionSC, &Store),
|
||||
VPValue(VPValue::VPVMemoryInstructionSC, &Store),
|
||||
VPUser({Addr, StoredValue}) {
|
||||
setMask(Mask);
|
||||
}
|
||||
|
@ -87,10 +87,10 @@ public:
|
||||
/// type identification.
|
||||
enum {
|
||||
VPValueSC,
|
||||
VPInstructionSC,
|
||||
VPMemoryInstructionSC,
|
||||
VPReductionSC,
|
||||
VPWidenSC,
|
||||
VPVInstructionSC,
|
||||
VPVMemoryInstructionSC,
|
||||
VPVReductionSC,
|
||||
VPVWidenSC,
|
||||
VPVWidenCallSC,
|
||||
VPVWidenGEPSC,
|
||||
VPVWidenSelectSC,
|
||||
|
@ -521,6 +521,19 @@ TEST(VPRecipeTest, CastVPWidenMemoryInstructionRecipeToVPUser) {
|
||||
delete Load;
|
||||
}
|
||||
|
||||
TEST(VPRecipeTest, CastVPReductionRecipeToVPUser) {
|
||||
LLVMContext C;
|
||||
|
||||
VPValue ChainOp;
|
||||
VPValue VecOp;
|
||||
VPValue CondOp;
|
||||
VPReductionRecipe Recipe(nullptr, nullptr, &ChainOp, &CondOp, &VecOp, false,
|
||||
nullptr);
|
||||
EXPECT_TRUE(isa<VPUser>(&Recipe));
|
||||
VPRecipeBase *BaseR = &Recipe;
|
||||
EXPECT_TRUE(isa<VPUser>(BaseR));
|
||||
}
|
||||
|
||||
struct VPDoubleValueDef : public VPUser, public VPDef {
|
||||
VPDoubleValueDef(ArrayRef<VPValue *> Operands) : VPUser(Operands), VPDef() {
|
||||
new VPValue(nullptr, this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user