[PATCH] D138412: [IndVarSimplify] Lift limitations on IV being a Phi for turn-to-invariant
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 21 20:35:18 PST 2022
mkazantsev added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyIndVar.cpp:224-229
+ if (Rewriter.isHighCostExpansion(InvariantLHS, L, SCEVCheapExpansionBudget,
+ TTI, PHTerm))
return false;
-
+ if (Rewriter.isHighCostExpansion(InvariantRHS, L, SCEVCheapExpansionBudget,
+ TTI, PHTerm))
+ return false;
----------------
lebedev.ri wrote:
> I guess this is slightly broken, if rhs is constant but lhs needs 2x the `SCEVCheapExpansionBudget`,
> we'd still want to expand. (Well, or they both in total should fit into `SCEVCheapExpansionBudget`).
> But that is a separate issue.
We can improve `isHighCostExpansion` to take several SCEVs and compute at once, I'll see how hard it is to do it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138412/new/
https://reviews.llvm.org/D138412
More information about the llvm-commits
mailing list