[PATCH] D73712: [SCEV] SCEVExpander::isHighCostExpansionHelper(): bailout if no TTI is present
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 08:13:45 PST 2020
lebedev.ri updated this revision to Diff 241468.
lebedev.ri added a comment.
Rebased, NFC.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73712/new/
https://reviews.llvm.org/D73712
Files:
llvm/lib/Analysis/ScalarEvolutionExpander.cpp
Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
===================================================================
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -2145,13 +2145,20 @@
// 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))
- return false;
+ return false; // Consider the expression to be free.
- // Zero/One operand expressions
switch (S->getSCEVType()) {
case scUnknown:
case scConstant:
- return false;
+ return false; // Assume to be zero-cost.
+ }
+
+ // The rest of the logic is recursive!
+ if (!TTI)
+ return true; // No cost model - give up.
+
+ // Zero/One operand expressions
+ switch (S->getSCEVType()) {
case scTruncate:
return isHighCostExpansionHelper(cast<SCEVTruncateExpr>(S)->getOperand(), L,
At, BudgetRemaining, TTI, Processed);
@@ -2163,7 +2170,6 @@
L, At, BudgetRemaining, TTI, Processed);
}
-
if (auto *UDivExpr = dyn_cast<SCEVUDivExpr>(S)) {
// If the divisor is a power of two and the SCEV type fits in a native
// integer (and the LHS not expensive), consider the division cheap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73712.241468.patch
Type: text/x-patch
Size: 1335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200130/551351a1/attachment-0001.bin>
More information about the llvm-commits
mailing list