[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
================
@@ -955,12 +998,13 @@ class LoopVectorizationCostModel {
// update instruction to each iteration of the loop. We exclude from this
// check the primary induction variable since it will need an update
// instruction regardless.
- Value *Op = Trunc->getOperand(0);
- if (Op != Legal->getPrimaryInduction() && TTI.isTruncateFree(SrcTy, DestTy))
+ if (Info.Phi != Legal->getPrimaryInduction() &&
+ TTI.isTruncateFree(SrcTy, DestTy))
return false;
- // If the truncated value is not an induction variable, return false.
- return Legal->isInductionPhi(Op);
+ if (IVInfo)
+ *IVInfo = Info;
+ return true;
----------------
artagnon wrote:
Why not just return a `std::optional<OptimizableIVTruncateInfo>` and strip the pointer arg?
https://github.com/llvm/llvm-project/pull/220730
More information about the llvm-commits
mailing list