[llvm] [VPlan] Optimize FindLast of (binop %IV, live-in) by sinking. (PR #183911)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 15:13:02 PST 2026
================
@@ -5679,6 +5679,43 @@ void VPlanTransforms::addExitUsersForFirstOrderRecurrences(VPlan &Plan,
}
}
+/// Check if \p V is a binary expression of a widened IV and a loop-invariant
+/// value. Returns the widened IV if found, nullptr otherwise.
+static VPWidenIntOrFpInductionRecipe *
+getExpressionIV(VPValue *V, VPRegionBlock *VectorLoopRegion) {
+ auto *BinOp = dyn_cast<VPWidenRecipe>(V);
+ if (!BinOp || !Instruction::isBinaryOp(BinOp->getOpcode()))
+ return nullptr;
+
+ VPWidenIntOrFpInductionRecipe *WideIV = nullptr;
+ for (VPValue *Op : BinOp->operands()) {
----------------
fhahn wrote:
Updated for now , turned out slightly simpler, thanks
https://github.com/llvm/llvm-project/pull/183911
More information about the llvm-commits
mailing list