[llvm] r273186 - [InstCombine] consolidate some icmp+logic tests and improve checks

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 11:40:37 PDT 2016


Author: spatel
Date: Mon Jun 20 13:40:37 2016
New Revision: 273186

URL: http://llvm.org/viewvc/llvm-project?rev=273186&view=rev
Log:
[InstCombine] consolidate some icmp+logic tests and improve checks

Added:
    llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll
Removed:
    llvm/trunk/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
    llvm/trunk/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll
    llvm/trunk/test/Transforms/InstCombine/2008-07-08-AndICmp.ll

Removed: llvm/trunk/test/Transforms/InstCombine/2007-01-27-AndICmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-01-27-AndICmp.ll?rev=273185&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2007-01-27-AndICmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-01-27-AndICmp.ll (removed)
@@ -1,8 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep "ugt.*, 1"
-
-define i1 @test(i32 %tmp1030) {
-	%tmp1037 = icmp ne i32 %tmp1030, 39		; <i1> [#uses=1]
-	%tmp1039 = icmp ne i32 %tmp1030, 40		; <i1> [#uses=1]
-	%tmp1042 = and i1 %tmp1037, %tmp1039		; <i1> [#uses=1]
-	ret i1 %tmp1042
-}

Removed: llvm/trunk/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll?rev=273185&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2007-11-22-IcmpCrash.ll (removed)
@@ -1,29 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -instcombine -S | FileCheck %s
-; PR1817
-
-define i1 @test1(i32 %X) {
-; CHECK-LABEL: @test1(
-; CHECK-NEXT:    [[A:%.*]] = icmp slt i32 %X, 10
-; CHECK-NEXT:    [[B:%.*]] = icmp ult i32 %X, 10
-; CHECK-NEXT:    [[C:%.*]] = and i1 [[A]], [[B]]
-; CHECK-NEXT:    ret i1 [[C]]
-;
-  %A = icmp slt i32 %X, 10
-  %B = icmp ult i32 %X, 10
-  %C = and i1 %A, %B
-  ret i1 %C
-}
-
-define i1 @test2(i32 %X) {
-; CHECK-LABEL: @test2(
-; CHECK-NEXT:    [[A:%.*]] = icmp slt i32 %X, 10
-; CHECK-NEXT:    [[B:%.*]] = icmp ult i32 %X, 10
-; CHECK-NEXT:    [[C:%.*]] = or i1 [[A]], [[B]]
-; CHECK-NEXT:    ret i1 [[C]]
-;
-  %A = icmp slt i32 %X, 10
-  %B = icmp ult i32 %X, 10
-  %C = or i1 %A, %B
-  ret i1 %C
-}

Removed: llvm/trunk/test/Transforms/InstCombine/2008-07-08-AndICmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2008-07-08-AndICmp.ll?rev=273185&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/2008-07-08-AndICmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/2008-07-08-AndICmp.ll (removed)
@@ -1,10 +0,0 @@
-; RUN: opt < %s -instcombine -S | grep icmp | count 1
-; PR2330
-
-define i1 @foo(i32 %a, i32 %b) nounwind {
-entry:
-	icmp ult i32 %a, 8		; <i1>:0 [#uses=1]
-	icmp ult i32 %b, 8		; <i1>:1 [#uses=1]
-	and i1 %1, %0		; <i1>:2 [#uses=1]
-	ret i1 %2
-}

Added: llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll?rev=273186&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll Mon Jun 20 13:40:37 2016
@@ -0,0 +1,53 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define i1 @PR1817_1(i32 %X) {
+; CHECK-LABEL: @PR1817_1(
+; CHECK-NEXT:    [[A:%.*]] = icmp slt i32 %X, 10
+; CHECK-NEXT:    [[B:%.*]] = icmp ult i32 %X, 10
+; CHECK-NEXT:    [[C:%.*]] = and i1 [[A]], [[B]]
+; CHECK-NEXT:    ret i1 [[C]]
+;
+  %A = icmp slt i32 %X, 10
+  %B = icmp ult i32 %X, 10
+  %C = and i1 %A, %B
+  ret i1 %C
+}
+
+define i1 @PR1817_2(i32 %X) {
+; CHECK-LABEL: @PR1817_2(
+; CHECK-NEXT:    [[A:%.*]] = icmp slt i32 %X, 10
+; CHECK-NEXT:    [[B:%.*]] = icmp ult i32 %X, 10
+; CHECK-NEXT:    [[C:%.*]] = or i1 [[A]], [[B]]
+; CHECK-NEXT:    ret i1 [[C]]
+;
+  %A = icmp slt i32 %X, 10
+  %B = icmp ult i32 %X, 10
+  %C = or i1 %A, %B
+  ret i1 %C
+}
+
+define i1 @PR2330(i32 %a, i32 %b) {
+; CHECK-LABEL: @PR2330(
+; CHECK-NEXT:    [[TMP1:%.*]] = or i32 %b, %a
+; CHECK-NEXT:    [[TMP2:%.*]] = icmp ult i32 [[TMP1]], 8
+; CHECK-NEXT:    ret i1 [[TMP2]]
+;
+  %cmp1 = icmp ult i32 %a, 8
+  %cmp2 = icmp ult i32 %b, 8
+  %and = and i1 %cmp2, %cmp1
+  ret i1 %and
+}
+
+define i1 @test(i32 %tmp1030) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT:    [[TMP1030_OFF:%.*]] = add i32 %tmp1030, -39
+; CHECK-NEXT:    [[TMP1030_CMP:%.*]] = icmp ugt i32 [[TMP1030_OFF]], 1
+; CHECK-NEXT:    ret i1 [[TMP1030_CMP]]
+;
+  %tmp1037 = icmp ne i32 %tmp1030, 39
+  %tmp1039 = icmp ne i32 %tmp1030, 40
+  %tmp1042 = and i1 %tmp1037, %tmp1039
+  ret i1 %tmp1042
+}
+




More information about the llvm-commits mailing list