[llvm] [LV] Widen truncated induction updates, not just truncated phis (PR #220730)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 8 03:18:56 PDT 2026
================
@@ -939,13 +954,41 @@ class LoopVectorizationCostModel {
/// Return True if instruction \p I is an optimizable truncate whose operand
/// is an induction variable. Such a truncate will be removed by adding a new
- /// induction variable with the destination type.
- bool isOptimizableIVTruncate(Instruction *I, ElementCount VF) {
+ /// induction variable with the destination type. On success, \p IVInfo, if
+ /// non-null, receives the matched phi and update.
+ bool isOptimizableIVTruncate(Instruction *I, ElementCount VF,
+ OptimizableIVTruncateInfo *IVInfo = nullptr) {
----------------
artagnon wrote:
I think this looks a lot like:
```cpp
/// 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) {
```
I wonder if it's possible to lift the logic in question to VPlan? I think we want to avoid extending legacy code, and do as much as possible in VPlan?
https://github.com/llvm/llvm-project/pull/220730
More information about the llvm-commits
mailing list