forked from OSchip/llvm-project
[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
This commit is contained in:
parent
8604783a3f
commit
5566092963
|
@ -250,7 +250,12 @@ bool LoopInvariantCodeMotion::runOnLoop(Loop *L, AliasAnalysis *AA,
|
||||||
|
|
||||||
// Now that all loop invariants have been removed from the loop, promote any
|
// Now that all loop invariants have been removed from the loop, promote any
|
||||||
// memory references to scalars that we can.
|
// 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<BasicBlock *, 8> ExitBlocks;
|
||||||
SmallVector<Instruction *, 8> InsertPts;
|
SmallVector<Instruction *, 8> InsertPts;
|
||||||
PredIteratorCache PIC;
|
PredIteratorCache PIC;
|
||||||
|
@ -909,15 +914,6 @@ bool llvm::promoteLoopAccessesToScalars(
|
||||||
// us to prove better alignment.
|
// us to prove better alignment.
|
||||||
unsigned Alignment = 1;
|
unsigned Alignment = 1;
|
||||||
AAMDNodes AATags;
|
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();
|
const DataLayout &MDL = Preheader->getModule()->getDataLayout();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue