summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-07-18 18:44:20 +0000
committerAndrew Trick <atrick@apple.com>2011-07-18 18:44:20 +0000
commit494c549ebd7e194df0a4df542e85253e2c824d32 (patch)
treef619e38c8a8f9ba957dec0035b891fd430671240 /llvm/lib
parent397d787642024ab66a9e0c1ca5421b421fcdcdf1 (diff)
downloadbcm5719-llvm-494c549ebd7e194df0a4df542e85253e2c824d32.tar.gz
bcm5719-llvm-494c549ebd7e194df0a4df542e85253e2c824d32.zip
indvars: Added verification that LFTR and other indvars goodness does
not interfere with BackedgeTakenCount computation. llvm-svn: 135412
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 3f7f5cefb4e..0078abd4d52 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1900,6 +1900,25 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
// Clean up dead instructions.
Changed |= DeleteDeadPHIs(L->getHeader());
// Check a post-condition.
- assert(L->isLCSSAForm(*DT) && "Indvars did not leave the loop in lcssa form!");
+ assert(L->isLCSSAForm(*DT) &&
+ "Indvars did not leave the loop in lcssa form!");
+
+ // Verify that LFTR, and any other change have not interfered with SCEV's
+ // ability to compute trip count.
+#ifndef NDEBUG
+ if (DisableIVRewrite && !isa<SCEVCouldNotCompute>(BackedgeTakenCount)) {
+ SE->forgetLoop(L);
+ const SCEV *NewBECount = SE->getBackedgeTakenCount(L);
+ if (SE->getTypeSizeInBits(BackedgeTakenCount->getType()) <
+ SE->getTypeSizeInBits(NewBECount->getType()))
+ NewBECount = SE->getTruncateOrNoop(NewBECount,
+ BackedgeTakenCount->getType());
+ else
+ BackedgeTakenCount = SE->getTruncateOrNoop(BackedgeTakenCount,
+ NewBECount->getType());
+ assert(BackedgeTakenCount == NewBECount && "indvars must preserve SCEV");
+ }
+#endif
+
return Changed;
}
OpenPOWER on IntegriCloud