Skip to content

Commit f57da2b

Browse files
lukel97kcloudy0717
authored andcommitted
[VPlan] Remove VPWidenRecipe constructor with no underlying instruction. NFCI (llvm#166521)
My understanding is that a VPWidenRecipe should be used for recipes with an exact underlying scalar instruction, and VPInstruction should be used elsewhere e.g. for instructions generated as a part of the vectorization process. The only user of the VPWidenRecipe constructor that doesn't take an underlying instruction is in adjustRecipesForReductions, but we can just use VPInstruction there.
1 parent 40408e7 commit f57da2b

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8807,9 +8807,9 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
88078807
match(CurrentLink, m_Sub(m_VPValue(), m_VPValue()))) {
88088808
Type *PhiTy = TypeInfo.inferScalarType(PhiR);
88098809
auto *Zero = Plan->getConstantInt(PhiTy, 0);
8810-
VPWidenRecipe *Sub = new VPWidenRecipe(
8811-
Instruction::Sub, {Zero, CurrentLink->getOperand(1)}, {},
8812-
VPIRMetadata(), CurrentLinkI->getDebugLoc());
8810+
auto *Sub = new VPInstruction(Instruction::Sub,
8811+
{Zero, CurrentLink->getOperand(1)}, {},
8812+
{}, CurrentLinkI->getDebugLoc());
88138813
Sub->setUnderlyingValue(CurrentLinkI);
88148814
LinkVPBB->insert(Sub, CurrentLink->getIterator());
88158815
VecOp = Sub;

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ class VPIRMetadata {
10101010
Metadata.emplace_back(Kind, Node);
10111011
}
10121012

1013-
/// Intersect this VPIRMetada object with \p MD, keeping only metadata
1013+
/// Intersect this VPIRMetadata object with \p MD, keeping only metadata
10141014
/// nodes that are common to both.
10151015
void intersect(const VPIRMetadata &MD);
10161016

@@ -1515,12 +1515,6 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
15151515
unsigned Opcode;
15161516

15171517
public:
1518-
VPWidenRecipe(unsigned Opcode, ArrayRef<VPValue *> Operands,
1519-
const VPIRFlags &Flags, const VPIRMetadata &Metadata,
1520-
DebugLoc DL)
1521-
: VPRecipeWithIRFlags(VPDef::VPWidenSC, Operands, Flags, DL),
1522-
VPIRMetadata(Metadata), Opcode(Opcode) {}
1523-
15241518
VPWidenRecipe(Instruction &I, ArrayRef<VPValue *> Operands,
15251519
const VPIRFlags &Flags = {}, const VPIRMetadata &Metadata = {},
15261520
DebugLoc DL = {})
@@ -1532,10 +1526,8 @@ class LLVM_ABI_FOR_TEST VPWidenRecipe : public VPRecipeWithIRFlags,
15321526
~VPWidenRecipe() override = default;
15331527

15341528
VPWidenRecipe *clone() override {
1535-
auto *R =
1536-
new VPWidenRecipe(getOpcode(), operands(), *this, *this, getDebugLoc());
1537-
R->setUnderlyingValue(getUnderlyingValue());
1538-
return R;
1529+
return new VPWidenRecipe(*getUnderlyingInstr(), operands(), *this, *this,
1530+
getDebugLoc());
15391531
}
15401532

15411533
VP_CLASSOF_IMPL(VPDef::VPWidenSC)

0 commit comments

Comments
 (0)