[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
This commit is contained in:
David Majnemer 2016-04-22 14:12:50 +00:00
parent 2e439346e9
commit 0c47b59618
2 changed files with 2 additions and 12 deletions

View File

@ -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);
}

View File

@ -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
}