[PATCH] D92159: [LSR][NFC] don't collect chains when isNumRegsMajorCostOfLSR is false
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 19:30:21 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3cb7d6245249: [LSR][NFC] don't collect chains when isNumRegsMajorCostOfLSR is false. (authored by shchenz).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92159/new/
https://reviews.llvm.org/D92159
Files:
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2858,20 +2858,12 @@
unsigned NumVarIncrements = 0;
unsigned NumReusedIncrements = 0;
- // If any LSRUse in the chain is marked as profitable by target, mark this
- // chain as profitable.
- for (const IVInc &Inc : Chain.Incs)
- if (TTI.isProfitableLSRChainElement(Inc.UserInst))
- return true;
-
- // If number of registers is not the major cost, we cannot benefit from this
- // profitable chain which is based on number of registers.
- // FIXME: add profitable chain optimization for other kinds major cost, for
- // example number of instructions.
- if (!TTI.isNumRegsMajorCostOfLSR())
- return false;
+ if (TTI.isProfitableLSRChainElement(Chain.Incs[0].UserInst))
+ return true;
for (const IVInc &Inc : Chain) {
+ if (TTI.isProfitableLSRChainElement(Inc.UserInst))
+ return true;
if (Inc.IncExpr->isZero())
continue;
@@ -5635,7 +5627,13 @@
}
// Start collecting data and preparing for the solver.
- CollectChains();
+ // If number of registers is not the major cost, we cannot benefit from the
+ // current profitable chain optimization which is based on number of
+ // registers.
+ // FIXME: add profitable chain optimization for other kinds major cost, for
+ // example number of instructions.
+ if (TTI.isNumRegsMajorCostOfLSR() || StressIVChain)
+ CollectChains();
CollectInterestingTypesAndFactors();
CollectFixupsAndInitialFormulae();
CollectLoopInvariantFixupsAndFormulae();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92159.308848.patch
Type: text/x-patch
Size: 1708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201202/1d7f72aa/attachment.bin>
More information about the llvm-commits
mailing list