[llvm] r258946 - [IndVars] Hoist DataLayout load out of loop; NFC
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 27 09:05:09 PST 2016
Author: sanjoy
Date: Wed Jan 27 11:05:09 2016
New Revision: 258946
URL: http://llvm.org/viewvc/llvm-project?rev=258946&view=rev
Log:
[IndVars] Hoist DataLayout load out of loop; NFC
Modified:
llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=258946&r1=258945&r2=258946&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Wed Jan 27 11:05:09 2016
@@ -1783,6 +1783,7 @@ static PHINode *FindLoopCounter(Loop *L,
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,
// 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));
More information about the llvm-commits
mailing list