diff options
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/InstCombine/and2.ll | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/and2.ll b/llvm/test/Transforms/InstCombine/and2.ll index b7f72833b17..0b4882fa823 100644 --- a/llvm/test/Transforms/InstCombine/and2.ll +++ b/llvm/test/Transforms/InstCombine/and2.ll @@ -122,12 +122,11 @@ define i64 @test10(i64 %x) { ret i64 %add } -; The add in this test is unnecessary because the LSBs of the RHS are 0 and we only consume those bits. +; The add in this test is unnecessary because the LSBs of the LHS are 0 and the 'and' only consumes bits from those LSBs. It doesn't matter what happens to the upper bits. define i32 @test11(i32 %a, i32 %b) { ; CHECK-LABEL: @test11( ; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8 -; CHECK-NEXT: [[Y:%.*]] = add i32 [[X]], [[B:%.*]] -; CHECK-NEXT: [[Z:%.*]] = and i32 [[Y]], 128 +; CHECK-NEXT: [[Z:%.*]] = and i32 [[B:%.*]], 128 ; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]] ; CHECK-NEXT: ret i32 [[W]] ; @@ -138,12 +137,11 @@ define i32 @test11(i32 %a, i32 %b) { ret i32 %w } -; The add in this test is unnecessary because the LSBs of the RHS are 0 and we only consume those bits. +; The add in this test is unnecessary because the LSBs of the RHS are 0 and the 'and' only consumes bits from those LSBs. It doesn't matter what happens to the upper bits. define i32 @test12(i32 %a, i32 %b) { ; CHECK-LABEL: @test12( ; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8 -; CHECK-NEXT: [[Y:%.*]] = add i32 [[X]], [[B:%.*]] -; CHECK-NEXT: [[Z:%.*]] = and i32 [[Y]], 128 +; CHECK-NEXT: [[Z:%.*]] = and i32 [[B:%.*]], 128 ; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]] ; CHECK-NEXT: ret i32 [[W]] ; @@ -154,12 +152,11 @@ define i32 @test12(i32 %a, i32 %b) { ret i32 %w } -; The sub in this test is unnecessary because the LSBs of the RHS are 0 and we only consume those bits. +; The sub in this test is unnecessary because the LSBs of the RHS are 0 and the 'and' only consumes bits from those LSBs. It doesn't matter what happens to the upper bits. define i32 @test13(i32 %a, i32 %b) { ; CHECK-LABEL: @test13( ; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8 -; CHECK-NEXT: [[Y:%.*]] = sub i32 [[B:%.*]], [[X]] -; CHECK-NEXT: [[Z:%.*]] = and i32 [[Y]], 128 +; CHECK-NEXT: [[Z:%.*]] = and i32 [[B:%.*]], 128 ; CHECK-NEXT: [[W:%.*]] = mul i32 [[Z]], [[X]] ; CHECK-NEXT: ret i32 [[W]] ; @@ -170,7 +167,7 @@ define i32 @test13(i32 %a, i32 %b) { ret i32 %w } -; The sub in this test cannot be removed because we need to keep the negation of %b +; The sub in this test cannot be removed because we need to keep the negation of %b. TODO: But we should be able to replace the LHS of it with a 0. define i32 @test14(i32 %a, i32 %b) { ; CHECK-LABEL: @test14( ; CHECK-NEXT: [[X:%.*]] = shl i32 [[A:%.*]], 8 |