diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2019-09-15 20:13:27 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2019-09-15 20:13:27 +0000 |
| commit | c77ad16f8e5fd0ff0791e86fbbff14c376a1081d (patch) | |
| tree | 2a7cebcb7d99666b5f9d709d030e32d130f82c54 | |
| parent | 07d824a7c39ee91c0971d46ae5ca6e125fe4daf0 (diff) | |
| download | bcm5719-llvm-c77ad16f8e5fd0ff0791e86fbbff14c376a1081d.tar.gz bcm5719-llvm-c77ad16f8e5fd0ff0791e86fbbff14c376a1081d.zip | |
[InstCombine] add icmp tests with extra uses; NFC
llvm-svn: 371939
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 3fecf97e89d..07ec4e7b40f 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -556,6 +556,23 @@ define i1 @test27(i32 %x, i32 %y, i32 %z) { ret i1 %c } +define i1 @test27_extra_uses(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @test27_extra_uses( +; CHECK-NEXT: [[LHS:%.*]] = sub nsw i32 [[X:%.*]], [[Z:%.*]] +; CHECK-NEXT: call void @foo(i32 [[LHS]]) +; CHECK-NEXT: [[RHS:%.*]] = sub nsw i32 [[Y:%.*]], [[Z]] +; CHECK-NEXT: call void @foo(i32 [[RHS]]) +; CHECK-NEXT: [[C:%.*]] = icmp sgt i32 [[LHS]], [[RHS]] +; CHECK-NEXT: ret i1 [[C]] +; + %lhs = sub nsw i32 %x, %z + call void @foo(i32 %lhs) + %rhs = sub nsw i32 %y, %z + call void @foo(i32 %rhs) + %c = icmp sgt i32 %lhs, %rhs + ret i1 %c +} + ; X - Z > Y - Z -> X > Y if there is no overflow. define i1 @test28(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @test28( @@ -568,6 +585,23 @@ define i1 @test28(i32 %x, i32 %y, i32 %z) { ret i1 %c } +define i1 @test28_extra_uses(i32 %x, i32 %y, i32 %z) { +; CHECK-LABEL: @test28_extra_uses( +; CHECK-NEXT: [[LHS:%.*]] = sub nuw i32 [[X:%.*]], [[Z:%.*]] +; CHECK-NEXT: call void @foo(i32 [[LHS]]) +; CHECK-NEXT: [[RHS:%.*]] = sub nuw i32 [[Y:%.*]], [[Z]] +; CHECK-NEXT: call void @foo(i32 [[RHS]]) +; CHECK-NEXT: [[C:%.*]] = icmp ugt i32 [[LHS]], [[RHS]] +; CHECK-NEXT: ret i1 [[C]] +; + %lhs = sub nuw i32 %x, %z + call void @foo(i32 %lhs) + %rhs = sub nuw i32 %y, %z + call void @foo(i32 %rhs) + %c = icmp ugt i32 %lhs, %rhs + ret i1 %c +} + ; X + Y > X -> Y > 0 if there is no overflow. define i1 @test29(i32 %x, i32 %y) { ; CHECK-LABEL: @test29( |

