diff options
author | Mehdi Amini <mehdi.amini@apple.com> | 2015-02-11 19:54:44 +0000 |
---|---|---|
committer | Mehdi Amini <mehdi.amini@apple.com> | 2015-02-11 19:54:44 +0000 |
commit | 9730116bd6792a91eb965c9fcab19b8f5095b29e (patch) | |
tree | 37fe540d215c8cce04497a67cbf0cab4d910dd11 /llvm/lib/Transforms/Scalar/Reassociate.cpp | |
parent | 349e0626953528454f2566bd56e6565ad5a4fd82 (diff) | |
download | llvm-9730116bd6792a91eb965c9fcab19b8f5095b29e.zip llvm-9730116bd6792a91eb965c9fcab19b8f5095b29e.tar.gz llvm-9730116bd6792a91eb965c9fcab19b8f5095b29e.tar.bz2 |
Reassociate: cannot negate a INT_MIN value
Summary:
When trying to canonicalize negative constants out of
multiplication expressions, we need to check that the
constant is not INT_MIN which cannot be negated.
Reviewers: mcrosier
Reviewed By: mcrosier
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D7286
From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 228872
Diffstat (limited to 'llvm/lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Reassociate.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index 0fd64e3..98016b4 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp @@ -1991,7 +1991,7 @@ Instruction *Reassociate::canonicalizeNegConstExpr(Instruction *I) { Constant *C = C0 ? C0 : C1; unsigned ConstIdx = C0 ? 0 : 1; if (auto *CI = dyn_cast<ConstantInt>(C)) { - if (!CI->isNegative()) + if (!CI->isNegative() || CI->isMinValue(true)) return nullptr; } else if (auto *CF = dyn_cast<ConstantFP>(C)) { if (!CF->isNegative()) |