summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-05-18 21:02:18 +0000
committerDan Gohman <gohman@apple.com>2011-05-18 21:02:18 +0000
commit3268e4d6920f943221f2541ea447178c72744f72 (patch)
treecbe0548cf9913db4936a969480978394dd3ff69c /llvm/lib/Transforms
parent699c9733914df3adcf9f6cf3e96b74d32262b142 (diff)
downloadbcm5719-llvm-3268e4d6920f943221f2541ea447178c72744f72.tar.gz
bcm5719-llvm-3268e4d6920f943221f2541ea447178c72744f72.zip
When forming an ICmpZero LSRUse, normalize the non-IV operand
of the comparison, so that the resulting expression is fully normalized. This fixes PR9939. llvm-svn: 131576
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 0d617bf8b10..886e1432acb 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2073,6 +2073,10 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
// x == y --> x - y == 0
const SCEV *N = SE.getSCEV(NV);
if (SE.isLoopInvariant(N, L)) {
+ // S is normalized, so normalize N before folding it into S
+ // to keep the result normalized.
+ N = TransformForPostIncUse(Normalize, N, CI, 0,
+ LF.PostIncLoops, SE, DT);
Kind = LSRUse::ICmpZero;
S = SE.getMinusSCEV(N, S);
}
OpenPOWER on IntegriCloud