[llvm] r267153 - [EarlyCSE] Don't add the overflow flags to the hash
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 22 07:12:53 PDT 2016
Author: majnemer
Date: Fri Apr 22 09:12:50 2016
New Revision: 267153
URL: http://llvm.org/viewvc/llvm-project?rev=267153&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/trunk/test/Transforms/EarlyCSE/basic.ll
Modified: llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp?rev=267153&r1=267152&r2=267153&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp Fri Apr 22 09:12:50 2016
@@ -97,15 +97,6 @@ unsigned DenseMapInfo<SimpleValue>::getH
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);
}
Modified: llvm/trunk/test/Transforms/EarlyCSE/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/EarlyCSE/basic.ll?rev=267153&r1=267152&r2=267153&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/EarlyCSE/basic.ll (original)
+++ llvm/trunk/test/Transforms/EarlyCSE/basic.ll Fri Apr 22 09:12:50 2016
@@ -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
}
More information about the llvm-commits
mailing list