[PATCH] D73706: [NFC][SCEV] SCEVExpander::isHighCostExpansionHelper(): check that we processed expression first
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 06:40:31 PST 2020
lebedev.ri created this revision.
lebedev.ri added reviewers: reames, mkazantsev, wmi, sanjoy, atrick, igor-laevsky.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri added a parent revision: D73705: [NFC][SCEV] Piping to pass new SCEVCheapExpansionBudget option into SCEVExpander::isHighCostExpansionHelper().
As far as i can tell this is still NFC.
Initially in rL146438 <https://reviews.llvm.org/rL146438> it was added at the top of the function,
later rL238507 <https://reviews.llvm.org/rL238507> dethroned it, and rL244474 <https://reviews.llvm.org/rL244474> did it again.
I'm not sure if we have already checked the cost of this expansion, we should be doing that again.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73706
Files:
llvm/lib/Analysis/ScalarEvolutionExpander.cpp
Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -2138,6 +2138,10 @@
bool SCEVExpander::isHighCostExpansionHelper(
const SCEV *S, Loop *L, const Instruction *At, int BudgetRemaining,
const TargetTransformInfo *TTI, SmallPtrSetImpl<const SCEV *> &Processed) {
+ // Was the cost of expansion of this expression already accounted for?
+ if (!Processed.insert(S).second)
+ return false; // We have already accounted for this expression.
+
// If we can find an existing value for this scev available at the point "At"
// then consider the expression cheap.
if (At && getRelatedExistingExpansion(S, At, L))
@@ -2159,8 +2163,6 @@
L, At, BudgetRemaining, TTI, Processed);
}
- if (!Processed.insert(S).second)
- return false;
if (auto *UDivExpr = dyn_cast<SCEVUDivExpr>(S)) {
// If the divisor is a power of two and the SCEV type fits in a native
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73706.241436.patch
Type: text/x-patch
Size: 1095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/73c9723a/attachment.bin>
More information about the llvm-commits
mailing list