summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-07-13 23:33:10 +0000
committerAndrew Trick <atrick@apple.com>2012-07-13 23:33:10 +0000
commite08c32249fca32cd7b122024a4ca252fcb235694 (patch)
tree923f5912e0f49151d6ce7ff084b99bc6cec72c3e /lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent31f61e8b221eee4f839687e9ec4df89a469a2652 (diff)
downloadllvm-e08c32249fca32cd7b122024a4ca252fcb235694.tar.gz
llvm-e08c32249fca32cd7b122024a4ca252fcb235694.tar.bz2
llvm-e08c32249fca32cd7b122024a4ca252fcb235694.tar.xz
LSR Fix: check SCEV expression safety before expansion.
All SCEV expressions used by LSR formulae must be safe to expand. i.e. they may not contain UDiv unless we can prove nonzero denominator. Fixes PR11356: LSR hoists UDiv. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 4ba969e675..c0cb13de73 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -2836,7 +2836,7 @@ void LSRInstance::CollectFixupsAndInitialFormulae() {
// x == y --> x - y == 0
const SCEV *N = SE.getSCEV(NV);
- if (SE.isLoopInvariant(N, L)) {
+ if (SE.isLoopInvariant(N, L) && isSafeToExpand(N)) {
// S is normalized, so normalize N before folding it into S
// to keep the result normalized.
N = TransformForPostIncUse(Normalize, N, CI, 0,