From e419f4669019434b6949e2386f8a15527c717e91 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 16 Sep 2019 15:33:40 +0000 Subject: [PATCH] [InstCombine] move tests for icmp+add; NFC llvm-svn: 372004 --- .../InstCombine/2009-01-31-Pressure.ll | 22 ------------ test/Transforms/InstCombine/icmp-add.ll | 35 +++++++++++++++++++ 2 files changed, 35 insertions(+), 22 deletions(-) delete mode 100644 test/Transforms/InstCombine/2009-01-31-Pressure.ll diff --git a/test/Transforms/InstCombine/2009-01-31-Pressure.ll b/test/Transforms/InstCombine/2009-01-31-Pressure.ll deleted file mode 100644 index 666b02e8ed0..00000000000 --- a/test/Transforms/InstCombine/2009-01-31-Pressure.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: opt < %s -instcombine -S | grep "%B = add i8 %b, %x" -; PR2698 - -declare void @use1(i1) -declare void @use8(i8) - -define void @test1(i8 %a, i8 %b, i8 %x) { - %A = add i8 %a, %x - %B = add i8 %b, %x - %C = icmp eq i8 %A, %B - call void @use1(i1 %C) - ret void -} - -define void @test2(i8 %a, i8 %b, i8 %x) { - %A = add i8 %a, %x - %B = add i8 %b, %x - %C = icmp eq i8 %A, %B - call void @use1(i1 %C) - call void @use8(i8 %A) - ret void -} diff --git a/test/Transforms/InstCombine/icmp-add.ll b/test/Transforms/InstCombine/icmp-add.ll index 87e01d2b3d5..ffbfbabd428 100644 --- a/test/Transforms/InstCombine/icmp-add.ll +++ b/test/Transforms/InstCombine/icmp-add.ll @@ -587,3 +587,38 @@ define i1 @sum_nuw_commute(i32 %x, i32 %y) { %c = icmp ugt i32 %x, %rhs ret i1 %c } + +; PR2698 - https://bugs.llvm.org/show_bug.cgi?id=2698 + +declare void @use1(i1) +declare void @use8(i8) + +define void @bzip1(i8 %a, i8 %b, i8 %x) { +; CHECK-LABEL: @bzip1( +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: call void @use1(i1 [[CMP]]) +; CHECK-NEXT: ret void +; + %add1 = add i8 %a, %x + %add2 = add i8 %b, %x + %cmp = icmp eq i8 %add1, %add2 + call void @use1(i1 %cmp) + ret void +} + +define void @bzip2(i8 %a, i8 %b, i8 %x) { +; CHECK-LABEL: @bzip2( +; CHECK-NEXT: [[ADD1:%.*]] = add i8 [[A:%.*]], [[X:%.*]] +; CHECK-NEXT: [[ADD2:%.*]] = add i8 [[B:%.*]], [[X]] +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[ADD1]], [[ADD2]] +; CHECK-NEXT: call void @use1(i1 [[CMP]]) +; CHECK-NEXT: call void @use8(i8 [[ADD1]]) +; CHECK-NEXT: ret void +; + %add1 = add i8 %a, %x + %add2 = add i8 %b, %x + %cmp = icmp eq i8 %add1, %add2 + call void @use1(i1 %cmp) + call void @use8(i8 %add1) + ret void +}