1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[IndVars] Hoist DataLayout load out of loop; NFC

llvm-svn: 258946
This commit is contained in:
Sanjoy Das 2016-01-27 17:05:09 +00:00
parent 2b5c58bf39
commit 9e137d144d

View File

@ -1783,6 +1783,7 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *BECount,
const SCEV *BestInit = nullptr;
BasicBlock *LatchBlock = L->getLoopLatch();
assert(LatchBlock && "needsLFTR should guarantee a loop latch");
const DataLayout &DL = L->getHeader()->getModule()->getDataLayout();
for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) {
PHINode *Phi = cast<PHINode>(I);
@ -1801,8 +1802,7 @@ static PHINode *FindLoopCounter(Loop *L, const SCEV *BECount,
// AR may be wider than BECount. With eq/ne tests overflow is immaterial.
// AR may not be a narrower type, or we may never exit.
uint64_t PhiWidth = SE->getTypeSizeInBits(AR->getType());
if (PhiWidth < BCWidth ||
!L->getHeader()->getModule()->getDataLayout().isLegalInteger(PhiWidth))
if (PhiWidth < BCWidth || !DL.isLegalInteger(PhiWidth))
continue;
const SCEV *Step = dyn_cast<SCEVConstant>(AR->getStepRecurrence(*SE));