summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMichael Kuperstein <mkuper@google.com>2016-12-29 22:37:13 +0000
committerMichael Kuperstein <mkuper@google.com>2016-12-29 22:37:13 +0000
commitb6da9cf3b765506fce0a954c29164ca56f85377c (patch)
treed7c061770ec4a6caccb6ca4b23d68aa53530847e /llvm/lib
parent80e8f562846e9d2b7c73f0feadb1c160f5e59a51 (diff)
downloadbcm5719-llvm-b6da9cf3b765506fce0a954c29164ca56f85377c.tar.gz
bcm5719-llvm-b6da9cf3b765506fce0a954c29164ca56f85377c.zip
[LICM] Only recompute LCSSA when we actually promoted something.
We want to recompute LCSSA only when we actually promoted a value. This means we only need to look at changes made by promotion when deciding whether to recompute it or not, not at regular sinking/hoisting. (This was what the code was documented as doing, just not what it did) Hopefully NFC. llvm-svn: 290726
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index c981a8ff96b..30a70379968 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -255,9 +255,11 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA,
SmallVector<Instruction *, 8> InsertPts;
PredIteratorCache PIC;
+ bool Promoted = false;
+
// Loop over all of the alias sets in the tracker object.
for (AliasSet &AS : *CurAST)
- Changed |= promoteLoopAccessesToScalars(
+ Promoted |= promoteLoopAccessesToScalars(
AS, ExitBlocks, InsertPts, PIC, LI, DT, TLI, L, CurAST, &SafetyInfo);
// Once we have promoted values across the loop body we have to recursively
@@ -266,9 +268,10 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA,
// FIXME: This is really heavy handed. It would be a bit better to use an
// SSAUpdater strategy during promotion that was LCSSA aware and reformed
// it as it went.
- if (Changed) {
+ if (Promoted)
formLCSSARecursively(*L, *DT, LI, SE);
- }
+
+ Changed |= Promoted;
}
// Check that neither this loop nor its parent have had LCSSA broken. LICM is
OpenPOWER on IntegriCloud