[llvm] r306410 - [LoopUnrollRuntime] Use SCEV exit count for calculating trip count. NFCI
Anna Thomas via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 07:14:35 PDT 2017
Author: annat
Date: Tue Jun 27 07:14:35 2017
New Revision: 306410
URL: http://llvm.org/viewvc/llvm-project?rev=306410&view=rev
Log:
[LoopUnrollRuntime] Use SCEV exit count for calculating trip count. NFCI
Instead of getBackEdgeTakenCount, use getExitCount on the latch exiting block
(which is proven to be the only exiting block in the loop to be unrolled).
Modified:
llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp?rev=306410&r1=306409&r2=306410&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopUnrollRuntime.cpp Tue Jun 27 07:14:35 2017
@@ -495,7 +495,11 @@ bool llvm::UnrollRuntimeLoopRemainder(Lo
// Only unroll loops with a computable trip count, and the trip count needs
// to be an int value (allowing a pointer type is a TODO item).
- const SCEV *BECountSC = SE->getBackedgeTakenCount(L);
+ // We calculate the backedge count by using getExitCount on the Latch block,
+ // which is proven to be the only exiting block in this loop. This is same as
+ // calculating getBackedgeTakenCount on the loop (which computes SCEV for all
+ // exiting blocks).
+ const SCEV *BECountSC = SE->getExitCount(L, Latch);
if (isa<SCEVCouldNotCompute>(BECountSC) ||
!BECountSC->getType()->isIntegerTy())
return false;
More information about the llvm-commits
mailing list