diff options
author | Davide Italiano <davide@freebsd.org> | 2015-05-11 21:02:34 +0000 |
---|---|---|
committer | Davide Italiano <davide@freebsd.org> | 2015-05-11 21:02:34 +0000 |
commit | 8ed0446e97ffa0016f16fc4515963c3454bd5ca3 (patch) | |
tree | ecd59a3165b875de2442561dd401adf4127e6fd1 /llvm/lib | |
parent | 5a99ecbbb3f629a99eee4b395fc8959cb711d66f (diff) | |
download | bcm5719-llvm-8ed0446e97ffa0016f16fc4515963c3454bd5ca3.tar.gz bcm5719-llvm-8ed0446e97ffa0016f16fc4515963c3454bd5ca3.zip |
[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.
llvm-svn: 237044
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp index 7bc291784ab..b57b7c276d7 100644 --- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp +++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp @@ -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. |