summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/and.ll
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-25 15:19:04 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-25 15:19:04 +0000
commitba011431938ec4e1716c13a1aada4510f547c89f (patch)
tree76cfb13de483dd990a650d6746d17b483efb91ea /llvm/test/Transforms/InstCombine/and.ll
parentf41b21e3848c5c215975593ff02843b50b7cca4d (diff)
downloadbcm5719-llvm-ba011431938ec4e1716c13a1aada4510f547c89f.tar.gz
bcm5719-llvm-ba011431938ec4e1716c13a1aada4510f547c89f.zip
[InstCombine] Add missing commute handling to (A | B) & (B ^ (~A)) -> (A & B)
The matching here wasn't able to handle all the possible commutes. It always assumed the not would be on the left of the xor, but that's not guaranteed. Differential Revision: https://reviews.llvm.org/D32474 llvm-svn: 301316
Diffstat (limited to 'llvm/test/Transforms/InstCombine/and.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/and.ll10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/test/Transforms/InstCombine/and.ll b/llvm/test/Transforms/InstCombine/and.ll
index 1816b2402e3..a2715c12fa8 100644
--- a/llvm/test/Transforms/InstCombine/and.ll
+++ b/llvm/test/Transforms/InstCombine/and.ll
@@ -617,10 +617,7 @@ final:
define i32 @test42(i32 %a, i32 %c, i32 %d) {
; CHECK-LABEL: @test42(
; CHECK-NEXT: [[FORCE:%.*]] = mul i32 [[C:%.*]], [[D:%.*]]
-; CHECK-NEXT: [[OR:%.*]] = or i32 [[FORCE]], [[A:%.*]]
-; CHECK-NEXT: [[NOTA:%.*]] = xor i32 [[A]], -1
-; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[FORCE]], [[NOTA]]
-; CHECK-NEXT: [[AND:%.*]] = and i32 [[XOR]], [[OR]]
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[FORCE]], [[A:%.*]]
; CHECK-NEXT: ret i32 [[AND]]
;
%force = mul i32 %c, %d ; forces the complexity sorting
@@ -634,10 +631,7 @@ define i32 @test42(i32 %a, i32 %c, i32 %d) {
define i32 @test43(i32 %a, i32 %c, i32 %d) {
; CHECK-LABEL: @test43(
; CHECK-NEXT: [[FORCE:%.*]] = mul i32 [[C:%.*]], [[D:%.*]]
-; CHECK-NEXT: [[OR:%.*]] = or i32 [[FORCE]], [[A:%.*]]
-; CHECK-NEXT: [[NOTA:%.*]] = xor i32 [[A]], -1
-; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[FORCE]], [[NOTA]]
-; CHECK-NEXT: [[AND:%.*]] = and i32 [[OR]], [[XOR]]
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[FORCE]], [[A:%.*]]
; CHECK-NEXT: ret i32 [[AND]]
;
%force = mul i32 %c, %d ; forces the complexity sorting
OpenPOWER on IntegriCloud