Skip to content

Commit dfc5f37

Browse files
committed
[VPlan] Move onlyFirstLaneUsed to VPWidenInductionRecipe (NFC).
Move onlyFirstLaneUsed from VPWidenIntOrFpInductionRecipe and VPWidenPointerInduction to VPWidenInductionRecipe. Also mark step value as having only its first lane used.
1 parent 3c90c90 commit dfc5f37

File tree

1 file changed

+10
-17
lines changed
  • llvm/lib/Transforms/Vectorize

1 file changed

+10
-17
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,16 @@ class VPWidenInductionRecipe : public VPHeaderPHIRecipe {
17551755
llvm_unreachable(
17561756
"VPWidenIntOrFpInductionRecipe generates its own backedge value");
17571757
}
1758+
1759+
/// Returns true if the recipe only uses the first lane of operand \p Op.
1760+
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1761+
assert(is_contained(operands(), Op) &&
1762+
"Op must be an operand of the recipe");
1763+
// The recipe creates its own wide start value, so it only requests the
1764+
// first lane of the operand.
1765+
// TODO: Remove once creating the start value is modeled separately.
1766+
return Op == getStartValue() || Op == getStepValue();
1767+
}
17581768
};
17591769

17601770
/// A recipe for handling phi nodes of integer and floating-point inductions,
@@ -1831,16 +1841,6 @@ class VPWidenIntOrFpInductionRecipe : public VPWidenInductionRecipe {
18311841
VPValue *getLastUnrolledPartOperand() {
18321842
return getNumOperands() == 5 ? getOperand(4) : this;
18331843
}
1834-
1835-
/// Returns true if the recipe only uses the first lane of operand \p Op.
1836-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1837-
assert(is_contained(operands(), Op) &&
1838-
"Op must be an operand of the recipe");
1839-
// The recipe creates its own wide start value, so it only requests the
1840-
// first lane of the operand.
1841-
// TODO: Remove once creating the start value is modeled separately.
1842-
return Op == getStartValue();
1843-
}
18441844
};
18451845

18461846
class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
@@ -1873,13 +1873,6 @@ class VPWidenPointerInductionRecipe : public VPWidenInductionRecipe,
18731873
/// Returns true if only scalar values will be generated.
18741874
bool onlyScalarsGenerated(bool IsScalable);
18751875

1876-
/// Returns true if the recipe only uses the first lane of operand \p Op.
1877-
bool onlyFirstLaneUsed(const VPValue *Op) const override {
1878-
assert(is_contained(operands(), Op) &&
1879-
"Op must be an operand of the recipe");
1880-
return Op == getOperand(0);
1881-
}
1882-
18831876
/// Returns the VPValue representing the value of this induction at
18841877
/// the first unrolled part, if it exists. Returns itself if unrolling did not
18851878
/// take place.

0 commit comments

Comments
 (0)