diff options
author | Andrew Trick <atrick@apple.com> | 2012-07-13 23:33:10 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2012-07-13 23:33:10 +0000 |
commit | e08c32249fca32cd7b122024a4ca252fcb235694 (patch) | |
tree | 923f5912e0f49151d6ce7ff084b99bc6cec72c3e /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 31f61e8b221eee4f839687e9ec4df89a469a2652 (diff) | |
download | external_llvm-e08c32249fca32cd7b122024a4ca252fcb235694.zip external_llvm-e08c32249fca32cd7b122024a4ca252fcb235694.tar.gz external_llvm-e08c32249fca32cd7b122024a4ca252fcb235694.tar.bz2 |
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.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4ba969e..c0cb13d 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, |