diff options
author | Haicheng Wu <haicheng@codeaurora.org> | 2016-10-12 21:02:22 +0000 |
---|---|---|
committer | Haicheng Wu <haicheng@codeaurora.org> | 2016-10-12 21:02:22 +0000 |
commit | 45e4ef737d2909d0f4856570d2c90a9a70f4037d (patch) | |
tree | 4b2ab8007a31b0dddcd30b13757303fc294bcfe7 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 726f96e63fa6c40d63b920af4c060cc6c5630e67 (diff) | |
download | bcm5719-llvm-45e4ef737d2909d0f4856570d2c90a9a70f4037d.tar.gz bcm5719-llvm-45e4ef737d2909d0f4856570d2c90a9a70f4037d.zip |
Revert "[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop"
This reverts commit r284044.
llvm-svn: 284051
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 8389e3c34c3..70e0c297a8d 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -5292,20 +5292,6 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { // Iteration Count Computation Code // -static unsigned getConstantTripCount(const SCEVConstant *ExitCount) { - if (!ExitCount) - return 0; - - ConstantInt *ExitConst = ExitCount->getValue(); - - // Guard against huge trip counts. - if (ExitConst->getValue().getActiveBits() > 32) - return 0; - - // In case of integer overflow, this returns 0, which is correct. - return ((unsigned)ExitConst->getZExtValue()) + 1; -} - unsigned ScalarEvolution::getSmallConstantTripCount(Loop *L) { if (BasicBlock *ExitingBB = L->getExitingBlock()) return getSmallConstantTripCount(L, ExitingBB); @@ -5321,13 +5307,17 @@ unsigned ScalarEvolution::getSmallConstantTripCount(Loop *L, "Exiting block must actually branch out of the loop!"); const SCEVConstant *ExitCount = dyn_cast<SCEVConstant>(getExitCount(L, ExitingBlock)); - return getConstantTripCount(ExitCount); -} + if (!ExitCount) + return 0; + + ConstantInt *ExitConst = ExitCount->getValue(); -unsigned ScalarEvolution::getSmallConstantMaxTripCount(Loop *L) { - const auto *MaxExitCount = - dyn_cast<SCEVConstant>(getMaxBackedgeTakenCount(L)); - return getConstantTripCount(MaxExitCount); + // Guard against huge trip counts. + if (ExitConst->getValue().getActiveBits() > 32) + return 0; + + // In case of integer overflow, this returns 0, which is correct. + return ((unsigned)ExitConst->getZExtValue()) + 1; } unsigned ScalarEvolution::getSmallConstantTripMultiple(Loop *L) { |