[llvm] r237044 - [LoopIdiomRecognize] Transform backedge-taken count check into an assertion.
Davide Italiano
davide at freebsd.org
Mon May 11 14:02:35 PDT 2015
Author: davide
Date: Mon May 11 16:02:34 2015
New Revision: 237044
URL: http://llvm.org/viewvc/llvm-project?rev=237044&view=rev
Log:
[LoopIdiomRecognize] Transform backedge-taken count check into an assertion.
runOnCountable() allowed the caller to call on a loop without a
predictable backedge-taken count. Change the code so that only loops
with computable backdge-count can call this function, in order to catch
abuses.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp?rev=237044&r1=237043&r2=237044&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Mon May 11 16:02:34 2015
@@ -611,7 +611,9 @@ bool NclPopcountRecognize::recognize() {
bool LoopIdiomRecognize::runOnCountableLoop() {
const SCEV *BECount = SE->getBackedgeTakenCount(CurLoop);
- if (isa<SCEVCouldNotCompute>(BECount)) return false;
+ assert(!isa<SCEVCouldNotCompute>(BECount) &&
+ "runOnCountableLoop() called on a loop without a predictable"
+ "backedge-taken count");
// If this loop executes exactly one time, then it should be peeled, not
// optimized by this pass.
More information about the llvm-commits
mailing list