[llvm] [VPlan] Narrow truncates of an induction plus a constant offset (PR #226035)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 00:09:33 PDT 2026
================
@@ -873,28 +873,52 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
}
}
-/// Check if \p VPV is an untruncated wide induction, either before or after the
-/// increment. If so return the header IV (before the increment), otherwise
-/// return null.
-static VPWidenInductionRecipe *
-getOptimizableIVOf(VPValue *VPV, PredicatedScalarEvolution &PSE) {
+/// Return the start value of \p WideIV rebased by the constant \p Offset, or
+/// nullptr if that does not fold to another constant. \p Offset is computed in
+/// the type of the induction's value, which is the type of its start value
+/// unless the induction is truncated.
+static VPValue *rebaseStartValue(VPWidenInductionRecipe *WideIV,
+ const APInt &Offset, VPlan &Plan) {
+ const APInt *StartC;
+ if (!match(WideIV->getStartValue(), m_APInt(StartC)) ||
+ StartC->getBitWidth() != Offset.getBitWidth())
----------------
artagnon wrote:
Unreachable? VPInstruction::(Add|Sub) always has operands of identical bitwidth?
https://github.com/llvm/llvm-project/pull/226035
More information about the llvm-commits
mailing list