mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[VPlan] Make VPWidenMemoryInstructionRecipe a VPDef.
This patch updates VPWidenMemoryInstructionRecipe to use VPDef to manage the value it produces instead of inheriting from VPValue. Reviewed By: gilr Differential Revision: https://reviews.llvm.org/D90563
This commit is contained in:
parent
18038eabcf
commit
8b3b1f6f2e
@ -8827,11 +8827,10 @@ void VPPredInstPHIRecipe::execute(VPTransformState &State) {
|
||||
}
|
||||
|
||||
void VPWidenMemoryInstructionRecipe::execute(VPTransformState &State) {
|
||||
Instruction *Instr = getUnderlyingInstr();
|
||||
VPValue *StoredValue = isa<StoreInst>(Instr) ? getStoredValue() : nullptr;
|
||||
State.ILV->vectorizeMemoryInstruction(Instr, State,
|
||||
StoredValue ? nullptr : this, getAddr(),
|
||||
StoredValue, getMask());
|
||||
VPValue *StoredValue = isStore() ? getStoredValue() : nullptr;
|
||||
State.ILV->vectorizeMemoryInstruction(&Ingredient, State,
|
||||
StoredValue ? nullptr : toVPValue(),
|
||||
getAddr(), StoredValue, getMask());
|
||||
}
|
||||
|
||||
// Determine how to lower the scalar epilogue, which depends on 1) optimising
|
||||
|
@ -124,8 +124,12 @@ VPValue *VPRecipeBase::toVPValue() {
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPReductionRecipe>(this))
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPWidenMemoryInstructionRecipe>(this))
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPWidenMemoryInstructionRecipe>(this)) {
|
||||
if (!V->isStore())
|
||||
return V->getVPValue();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
if (auto *V = dyn_cast<VPWidenCallRecipe>(this))
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPWidenSelectRecipe>(this))
|
||||
@ -144,8 +148,12 @@ const VPValue *VPRecipeBase::toVPValue() const {
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPReductionRecipe>(this))
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPWidenMemoryInstructionRecipe>(this))
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPWidenMemoryInstructionRecipe>(this)) {
|
||||
if (!V->isStore())
|
||||
return V->getVPValue();
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
if (auto *V = dyn_cast<VPWidenCallRecipe>(this))
|
||||
return V;
|
||||
if (auto *V = dyn_cast<VPWidenSelectRecipe>(this))
|
||||
@ -993,10 +1001,10 @@ void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent,
|
||||
O << "\"WIDEN ";
|
||||
|
||||
if (!isStore()) {
|
||||
printAsOperand(O, SlotTracker);
|
||||
getVPValue()->printAsOperand(O, SlotTracker);
|
||||
O << " = ";
|
||||
}
|
||||
O << Instruction::getOpcodeName(getUnderlyingInstr()->getOpcode()) << " ";
|
||||
O << Instruction::getOpcodeName(Ingredient.getOpcode()) << " ";
|
||||
|
||||
printOperands(O, SlotTracker);
|
||||
}
|
||||
|
@ -1265,8 +1265,9 @@ public:
|
||||
/// TODO: We currently execute only per-part unless a specific instance is
|
||||
/// provided.
|
||||
class VPWidenMemoryInstructionRecipe : public VPRecipeBase,
|
||||
public VPValue,
|
||||
public VPDef,
|
||||
public VPUser {
|
||||
Instruction &Ingredient;
|
||||
|
||||
void setMask(VPValue *Mask) {
|
||||
if (!Mask)
|
||||
@ -1280,16 +1281,16 @@ class VPWidenMemoryInstructionRecipe : public VPRecipeBase,
|
||||
|
||||
public:
|
||||
VPWidenMemoryInstructionRecipe(LoadInst &Load, VPValue *Addr, VPValue *Mask)
|
||||
: VPRecipeBase(VPWidenMemoryInstructionSC),
|
||||
VPValue(VPValue::VPVMemoryInstructionSC, &Load), VPUser({Addr}) {
|
||||
: VPRecipeBase(VPWidenMemoryInstructionSC), VPUser({Addr}),
|
||||
Ingredient(Load) {
|
||||
new VPValue(VPValue::VPVMemoryInstructionSC, &Load, this);
|
||||
setMask(Mask);
|
||||
}
|
||||
|
||||
VPWidenMemoryInstructionRecipe(StoreInst &Store, VPValue *Addr,
|
||||
VPValue *StoredValue, VPValue *Mask)
|
||||
: VPRecipeBase(VPWidenMemoryInstructionSC),
|
||||
VPValue(VPValue::VPVMemoryInstructionSC, &Store),
|
||||
VPUser({Addr, StoredValue}) {
|
||||
: VPRecipeBase(VPWidenMemoryInstructionSC), VPUser({Addr, StoredValue}),
|
||||
Ingredient(Store) {
|
||||
setMask(Mask);
|
||||
}
|
||||
|
||||
@ -1311,7 +1312,7 @@ public:
|
||||
}
|
||||
|
||||
/// Returns true if this recipe is a store.
|
||||
bool isStore() const { return isa<StoreInst>(getUnderlyingInstr()); }
|
||||
bool isStore() const { return isa<StoreInst>(Ingredient); }
|
||||
|
||||
/// Return the address accessed by this recipe.
|
||||
VPValue *getStoredValue() const {
|
||||
|
@ -36,6 +36,7 @@ class VPSlotTracker;
|
||||
class VPUser;
|
||||
class VPRecipeBase;
|
||||
class VPPredInstPHIRecipe;
|
||||
class VPWidenMemoryInstructionRecipe;
|
||||
|
||||
// This is the base class of the VPlan Def/Use graph, used for modeling the data
|
||||
// flow into, within and out of the VPlan. VPValues can stand for live-ins
|
||||
@ -50,6 +51,7 @@ class VPValue {
|
||||
friend class VPSlotTracker;
|
||||
friend class VPRecipeBase;
|
||||
friend class VPPredInstPHIRecipe;
|
||||
friend class VPWidenMemoryInstructionRecipe;
|
||||
|
||||
const unsigned char SubclassID; ///< Subclass identifier (for isa/dyn_cast).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user