diff options
author | Craig Topper <craig.topper@intel.com> | 2017-06-19 16:23:49 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2017-06-19 16:23:49 +0000 |
commit | a7529b68cc1a74d5d7e66db833f174f77f0bb2a7 (patch) | |
tree | da766140ce3c30c359b6912979051e137b47ed6c /llvm/test/Transforms | |
parent | ef85498e05e62325760b3e6e439984893d9d7c3e (diff) | |
download | bcm5719-llvm-a7529b68cc1a74d5d7e66db833f174f77f0bb2a7.tar.gz bcm5719-llvm-a7529b68cc1a74d5d7e66db833f174f77f0bb2a7.zip |
[InstCombine] Cleanup some duplicated one use checks
Summary:
These 4 patterns have the same one use check repeated twice for each. Once without a cast and one with. But the cast has no effect on what method is called.
For the OR case I believe it is always profitable regardless of the number of uses since we'll never increase the instruction count.
For the AND case I believe it is profitable if the pair of xors has one use such that we'll get rid of it completely. Or if the C value is something freely invertible, in which case the not doesn't cost anything.
Reviewers: spatel, majnemer
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34308
llvm-svn: 305705
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/InstCombine/or-xor.ll | 4 | ||||
-rw-r--r-- | llvm/test/Transforms/InstCombine/xor2.ll | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/llvm/test/Transforms/InstCombine/or-xor.ll b/llvm/test/Transforms/InstCombine/or-xor.ll index 485f9612376..af62c2dd4ba 100644 --- a/llvm/test/Transforms/InstCombine/or-xor.ll +++ b/llvm/test/Transforms/InstCombine/or-xor.ll @@ -316,7 +316,7 @@ define i8 @test17(i8 %A, i8 %B) { ; CHECK-NEXT: [[XOR1:%.*]] = xor i8 [[B:%.*]], [[A:%.*]] ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[A]], 33 ; CHECK-NEXT: [[XOR2:%.*]] = xor i8 [[NOT]], [[B]] -; CHECK-NEXT: [[OR:%.*]] = or i8 [[XOR1]], [[XOR2]] +; CHECK-NEXT: [[OR:%.*]] = or i8 [[XOR1]], 33 ; CHECK-NEXT: [[RES:%.*]] = mul i8 [[OR]], [[XOR2]] ; CHECK-NEXT: ret i8 [[RES]] ; @@ -333,7 +333,7 @@ define i8 @test18(i8 %A, i8 %B) { ; CHECK-NEXT: [[XOR1:%.*]] = xor i8 [[B:%.*]], [[A:%.*]] ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[A]], 33 ; CHECK-NEXT: [[XOR2:%.*]] = xor i8 [[NOT]], [[B]] -; CHECK-NEXT: [[OR:%.*]] = or i8 [[XOR2]], [[XOR1]] +; CHECK-NEXT: [[OR:%.*]] = or i8 [[XOR1]], 33 ; CHECK-NEXT: [[RES:%.*]] = mul i8 [[OR]], [[XOR2]] ; CHECK-NEXT: ret i8 [[RES]] ; diff --git a/llvm/test/Transforms/InstCombine/xor2.ll b/llvm/test/Transforms/InstCombine/xor2.ll index 49e6b999fbc..3061bdf8790 100644 --- a/llvm/test/Transforms/InstCombine/xor2.ll +++ b/llvm/test/Transforms/InstCombine/xor2.ll @@ -330,7 +330,7 @@ define i8 @test15(i8 %A, i8 %B) { ; CHECK-NEXT: [[XOR1:%.*]] = xor i8 [[B:%.*]], [[A:%.*]] ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[A]], 33 ; CHECK-NEXT: [[XOR2:%.*]] = xor i8 [[NOT]], [[B]] -; CHECK-NEXT: [[AND:%.*]] = and i8 [[XOR1]], [[XOR2]] +; CHECK-NEXT: [[AND:%.*]] = and i8 [[XOR1]], -34 ; CHECK-NEXT: [[RES:%.*]] = mul i8 [[AND]], [[XOR2]] ; CHECK-NEXT: ret i8 [[RES]] ; @@ -347,7 +347,7 @@ define i8 @test16(i8 %A, i8 %B) { ; CHECK-NEXT: [[XOR1:%.*]] = xor i8 [[B:%.*]], [[A:%.*]] ; CHECK-NEXT: [[NOT:%.*]] = xor i8 [[A]], 33 ; CHECK-NEXT: [[XOR2:%.*]] = xor i8 [[NOT]], [[B]] -; CHECK-NEXT: [[AND:%.*]] = and i8 [[XOR2]], [[XOR1]] +; CHECK-NEXT: [[AND:%.*]] = and i8 [[XOR1]], -34 ; CHECK-NEXT: [[RES:%.*]] = mul i8 [[AND]], [[XOR2]] ; CHECK-NEXT: ret i8 [[RES]] ; |