From 45e4ef737d2909d0f4856570d2c90a9a70f4037d Mon Sep 17 00:00:00 2001 From: Haicheng Wu Date: Wed, 12 Oct 2016 21:02:22 +0000 Subject: Revert "[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop" This reverts commit r284044. llvm-svn: 284051 --- llvm/lib/Analysis/ScalarEvolution.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'llvm/lib/Analysis') 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(getExitCount(L, ExitingBlock)); - return getConstantTripCount(ExitCount); -} + if (!ExitCount) + return 0; + + ConstantInt *ExitConst = ExitCount->getValue(); -unsigned ScalarEvolution::getSmallConstantMaxTripCount(Loop *L) { - const auto *MaxExitCount = - dyn_cast(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) { -- cgit v1.2.3