aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-01-27 17:05:09 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-01-27 17:05:09 +0000
commitcddde58f1c5d6956f669f690fb65920314f4e727 (patch)
treead92e885a5c0c010184532b4d0f3a3ddd30def42 /llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
parent2f7a7447c2d44ef65548cbe746ae44a886630f12 (diff)
downloadllvm-cddde58f1c5d6956f669f690fb65920314f4e727.zip
llvm-cddde58f1c5d6956f669f690fb65920314f4e727.tar.gz
llvm-cddde58f1c5d6956f669f690fb65920314f4e727.tar.bz2
[IndVars] Hoist DataLayout load out of loop; NFC
llvm-svn: 258946
Diffstat (limited to 'llvm/lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index b9d3bf5..02c2629 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -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));