diff options
| author | Dan Gohman <gohman@apple.com> | 2010-02-17 00:41:53 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-02-17 00:41:53 +0000 |
| commit | 7047308f48034448793465a98831b0b11ddfea6b (patch) | |
| tree | 1de68e18151f0705201fc50f3542d46952e971bf /lib/Transforms | |
| parent | 4a37ffb25dce44c185f06b0510ff24022b07f55e (diff) | |
| download | external_llvm-7047308f48034448793465a98831b0b11ddfea6b.zip external_llvm-7047308f48034448793465a98831b0b11ddfea6b.tar.gz external_llvm-7047308f48034448793465a98831b0b11ddfea6b.tar.bz2 | |
Don't attempt to divide INT_MIN by -1; consider such cases to
have overflowed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index dddc65a..9d11876 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2112,12 +2112,16 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx, Formula F = Base; // Check that the multiplication doesn't overflow. + if (F.AM.BaseOffs == INT64_MIN && Factor == -1) + continue; F.AM.BaseOffs = (uint64_t)Base.AM.BaseOffs * Factor; if ((int64_t)F.AM.BaseOffs / Factor != Base.AM.BaseOffs) continue; // Check that multiplying with the use offset doesn't overflow. int64_t Offset = LU.MinOffset; + if (Offset == INT64_MIN && Factor == -1) + continue; Offset = (uint64_t)Offset * Factor; if ((int64_t)Offset / Factor != LU.MinOffset) continue; |
