diff options
author | Michael Kuperstein <mkuper@google.com> | 2016-12-29 22:51:22 +0000 |
---|---|---|
committer | Michael Kuperstein <mkuper@google.com> | 2016-12-29 22:51:22 +0000 |
commit | 556609296341c2a09fe650c2a1102d0d89458f75 (patch) | |
tree | d76f0f06238e8b0e5cbdfbd38c14437944e930b0 /llvm/lib/Transforms | |
parent | 8604783a3f119e97d23738500abd2d6f93325111 (diff) | |
download | bcm5719-llvm-556609296341c2a09fe650c2a1102d0d89458f75.tar.gz bcm5719-llvm-556609296341c2a09fe650c2a1102d0d89458f75.zip |
[LICM] Don't try to promote in loops where we have no chance to promote. NFC.
We would check whether we have a prehader *or* dedicated exit blocks,
and go into the promotion loop. Then, for each alias set we'd check
if we have a preheader *and* dedicated exit blocks, and bail if not.
Instead, bail immediately if we don't have both.
llvm-svn: 290728
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LICM.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 30a70379968..79dc103a774 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -250,7 +250,12 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA, // Now that all loop invariants have been removed from the loop, promote any // memory references to scalars that we can. - if (!DisablePromotion && (Preheader || L->hasDedicatedExits())) { + // Don't sink stores from loops without dedicated block exits. Exits + // containing indirect branches are not transformed by loop simplify, + // make sure we catch that. An additional load may be generated in the + // preheader for SSA updater, so also avoid sinking when no preheader + // is available. + if (!DisablePromotion && Preheader && L->hasDedicatedExits()) { SmallVector<BasicBlock *, 8> ExitBlocks; SmallVector<Instruction *, 8> InsertPts; PredIteratorCache PIC; @@ -909,15 +914,6 @@ bool llvm::promoteLoopAccessesToScalars( // us to prove better alignment. unsigned Alignment = 1; AAMDNodes AATags; - bool HasDedicatedExits = CurLoop->hasDedicatedExits(); - - // Don't sink stores from loops without dedicated block exits. Exits - // containing indirect branches are not transformed by loop simplify, - // make sure we catch that. An additional load may be generated in the - // preheader for SSA updater, so also avoid sinking when no preheader - // is available. - if (!HasDedicatedExits || !Preheader) - return false; const DataLayout &MDL = Preheader->getModule()->getDataLayout(); |