Skip to content

Commit 0ffb8c1

Browse files
committed
Return reference from getVecOpXInfo
1 parent 79002b0 commit 0ffb8c1

File tree

1 file changed

+8
-9
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+8
-9
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2706,7 +2706,8 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
27062706
WrapFlagsTy(MulAcc->hasNoUnsignedWrap(), MulAcc->hasNoSignedWrap()),
27072707
MulAcc->getDebugLoc()),
27082708
ResultTy(MulAcc->getResultType()),
2709-
VFScaleFactor(MulAcc->getVFScaleFactor()) {
2709+
VFScaleFactor(MulAcc->getVFScaleFactor()),
2710+
VecOpInfo{MulAcc->getVecOp0Info(), MulAcc->getVecOp1Info()} {
27102711
transferFlags(*MulAcc);
27112712
setUnderlyingValue(MulAcc->getUnderlyingValue());
27122713
VecOpInfo[0] = MulAcc->getVecOp0Info();
@@ -2724,17 +2725,15 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
27242725
R->getCondOp(), R->isOrdered(),
27252726
WrapFlagsTy(Mul->hasNoUnsignedWrap(), Mul->hasNoSignedWrap()),
27262727
R->getDebugLoc()),
2727-
ResultTy(ResultTy), VFScaleFactor(ScaleFactor) {
2728+
ResultTy(ResultTy), VFScaleFactor(ScaleFactor),
2729+
VecOpInfo{
2730+
{Ext0->getOpcode(), Ext0->hasNonNegFlag() && Ext0->isNonNeg()},
2731+
{Ext1->getOpcode(), Ext1->hasNonNegFlag() && Ext1->isNonNeg()}} {
27282732
assert(RecurrenceDescriptor::getOpcode(getRecurrenceKind()) ==
27292733
Instruction::Add &&
27302734
"The reduction instruction in MulAccumulateteReductionRecipe must "
27312735
"be Add");
27322736
setUnderlyingValue(R->getUnderlyingValue());
2733-
// Only set the non-negative flag if the original recipe contains one.
2734-
VecOpInfo[0] = {Ext0->getOpcode(),
2735-
Ext0->hasNonNegFlag() && Ext0->isNonNeg()};
2736-
VecOpInfo[1] = {Ext1->getOpcode(),
2737-
Ext1->hasNonNegFlag() && Ext1->isNonNeg()};
27382737
assert(((Ext0->getOpcode() == Instruction::CastOps::ZExt ||
27392738
Ext0->getOpcode() == Instruction::CastOps::SExt) &&
27402739
(Ext1->getOpcode() == Instruction::CastOps::ZExt ||
@@ -2809,8 +2808,8 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
28092808
/// output
28102809
unsigned getVFScaleFactor() const { return VFScaleFactor; }
28112810

2812-
VecOperandInfo getVecOp0Info() const { return VecOpInfo[0]; }
2813-
VecOperandInfo getVecOp1Info() const { return VecOpInfo[1]; }
2811+
const VecOperandInfo &getVecOp0Info() const { return VecOpInfo[0]; }
2812+
const VecOperandInfo &getVecOp1Info() const { return VecOpInfo[1]; }
28142813

28152814
protected:
28162815
VecOperandInfo VecOpInfo[2];

0 commit comments

Comments
 (0)