diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-04-22 14:12:50 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-04-22 14:12:50 +0000 |
commit | bfd695d591c20242a2bd7544a0f9edb8018c7ba2 (patch) | |
tree | 978c77298ac88e397f52838feb86a00daf356ffe | |
parent | 9a878c4930b586bac36495aedfbceabab6906cd1 (diff) | |
download | bcm5719-llvm-bfd695d591c20242a2bd7544a0f9edb8018c7ba2.tar.gz bcm5719-llvm-bfd695d591c20242a2bd7544a0f9edb8018c7ba2.zip |
[EarlyCSE] Don't add the overflow flags to the hash
We take the intersection of overflow flags while CSE'ing.
This permits us to consider two instructions with different overflow
behavior to be replaceable.
llvm-svn: 267153
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 9 | ||||
-rw-r--r-- | llvm/test/Transforms/EarlyCSE/basic.ll | 5 |
2 files changed, 2 insertions, 12 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index efa843cd8c9..949300b94a7 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -97,15 +97,6 @@ unsigned DenseMapInfo<SimpleValue>::getHashValue(SimpleValue Val) { if (BinOp->isCommutative() && BinOp->getOperand(0) > BinOp->getOperand(1)) std::swap(LHS, RHS); - if (isa<OverflowingBinaryOperator>(BinOp)) { - // Hash the overflow behavior - unsigned Overflow = - BinOp->hasNoSignedWrap() * OverflowingBinaryOperator::NoSignedWrap | - BinOp->hasNoUnsignedWrap() * - OverflowingBinaryOperator::NoUnsignedWrap; - return hash_combine(BinOp->getOpcode(), Overflow, LHS, RHS); - } - return hash_combine(BinOp->getOpcode(), LHS, RHS); } diff --git a/llvm/test/Transforms/EarlyCSE/basic.ll b/llvm/test/Transforms/EarlyCSE/basic.ll index 8c9b74b4d0e..fa1a7059db9 100644 --- a/llvm/test/Transforms/EarlyCSE/basic.ll +++ b/llvm/test/Transforms/EarlyCSE/basic.ll @@ -26,10 +26,9 @@ define void @test1(i8 %V, i32 *%P) { ; CHECK-NEXT: store volatile i32 %E ; CHECK-NEXT: store volatile i32 %E - %G = add nuw i32 %C, %C ;; not a CSE with E + %G = add nuw i32 %C, %C store volatile i32 %G, i32* %P - ; CHECK-NEXT: %G = add nuw i32 %C, %C - ; CHECK-NEXT: store volatile i32 %G + ; CHECK-NEXT: store volatile i32 %E ret void } |