From 2ff352963d124bf8bb9e5feb5249f11d8fb4851f Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 25 Mar 2016 17:16:32 +0000 Subject: [PATCH] [InstCombine] consolidate regression tests of the ancients (2002) Testing out the check-generator-script that's now in the utils folder. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264424 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../InstCombine/2002-03-11-InstCombineHang.ll | 9 ---- .../InstCombine/2002-05-14-SubFailure.ll | 11 ---- .../InstCombine/2002-08-02-CastTest.ll | 11 ---- .../InstCombine/2002-12-05-MissedConstProp.ll | 13 ----- test/Transforms/InstCombine/misc-2002.ll | 50 +++++++++++++++++++ 5 files changed, 50 insertions(+), 44 deletions(-) delete mode 100644 test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll delete mode 100644 test/Transforms/InstCombine/2002-05-14-SubFailure.ll delete mode 100644 test/Transforms/InstCombine/2002-08-02-CastTest.ll delete mode 100644 test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll create mode 100644 test/Transforms/InstCombine/misc-2002.ll diff --git a/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll b/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll deleted file mode 100644 index 5d027a74492..00000000000 --- a/test/Transforms/InstCombine/2002-03-11-InstCombineHang.ll +++ /dev/null @@ -1,9 +0,0 @@ -; This testcase causes instcombine to hang. -; -; RUN: opt < %s -instcombine - -define void @test(i32 %X) { - %reg117 = add i32 %X, 0 ; [#uses=0] - ret void -} - diff --git a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll b/test/Transforms/InstCombine/2002-05-14-SubFailure.ll deleted file mode 100644 index 854ec604d01..00000000000 --- a/test/Transforms/InstCombine/2002-05-14-SubFailure.ll +++ /dev/null @@ -1,11 +0,0 @@ -; Instcombine was missing a test that caused it to make illegal transformations -; sometimes. In this case, it transforms the sub into an add: -; RUN: opt < %s -instcombine -S | FileCheck %s -; CHECK: sub - -define i32 @test(i32 %i, i32 %j) { - %A = mul i32 %i, %j - %B = sub i32 2, %A - ret i32 %B -} - diff --git a/test/Transforms/InstCombine/2002-08-02-CastTest.ll b/test/Transforms/InstCombine/2002-08-02-CastTest.ll deleted file mode 100644 index 363cb21e395..00000000000 --- a/test/Transforms/InstCombine/2002-08-02-CastTest.ll +++ /dev/null @@ -1,11 +0,0 @@ -; This testcase is incorrectly getting completely eliminated. There should be -; SOME instruction named %c here, even if it's a bitwise and. -; -; RUN: opt < %s -instcombine -S | grep %c -; -define i64 @test3(i64 %A) { - %c1 = trunc i64 %A to i8 ; [#uses=1] - %c2 = zext i8 %c1 to i64 ; [#uses=1] - ret i64 %c2 -} - diff --git a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll b/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll deleted file mode 100644 index 49e55c620a4..00000000000 --- a/test/Transforms/InstCombine/2002-12-05-MissedConstProp.ll +++ /dev/null @@ -1,13 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s - -; CHECK-NOT: add - -define i32 @test(i32 %A) { - %A.neg = sub i32 0, %A ; [#uses=1] - %.neg = sub i32 0, 1 ; [#uses=1] - %X = add i32 %.neg, 1 ; [#uses=1] - %Y.neg.ra = add i32 %A, %X ; [#uses=1] - %r = add i32 %A.neg, %Y.neg.ra ; [#uses=1] - ret i32 %r -} - diff --git a/test/Transforms/InstCombine/misc-2002.ll b/test/Transforms/InstCombine/misc-2002.ll new file mode 100644 index 00000000000..9985bbe3c80 --- /dev/null +++ b/test/Transforms/InstCombine/misc-2002.ll @@ -0,0 +1,50 @@ +; NOTE: Assertions have been autogenerated by update_test_checks.py +; RUN: opt < %s -instcombine -S | FileCheck %s + +define void @hang_2002-03-11(i32 %X) { +; CHECK-LABEL: @hang_2002-03-11( +; CHECK: ret void +; + %reg117 = add i32 %X, 0 + ret void +} + +; Instcombine was missing a test that caused it to make illegal transformations +; sometimes. In this case, it transformed the sub into an add: + +define i32 @sub_failure_2002-05-14(i32 %i, i32 %j) { +; CHECK-LABEL: @sub_failure_2002-05-14( +; CHECK: [[A:%.*]] = mul i32 %i, %j +; CHECK-NEXT: [[B:%.*]] = sub i32 2, [[A]] +; CHECK-NEXT: ret i32 [[B]] +; + %A = mul i32 %i, %j + %B = sub i32 2, %A + ret i32 %B +} + +; This testcase was incorrectly getting completely eliminated. There should be +; SOME instruction named %c here, even if it's a bitwise and. + +define i64 @cast_test_2002-08-02(i64 %A) { +; CHECK-LABEL: @cast_test_2002-08-02( +; CHECK: [[C2:%.*]] = and i64 %A, 255 +; CHECK-NEXT: ret i64 [[C2]] +; + %c1 = trunc i64 %A to i8 + %c2 = zext i8 %c1 to i64 + ret i64 %c2 +} + +define i32 @missed_const_prop_2002-12-05(i32 %A) { +; CHECK-LABEL: @missed_const_prop_2002-12-05( +; CHECK: ret i32 0 +; + %A.neg = sub i32 0, %A + %.neg = sub i32 0, 1 + %X = add i32 %.neg, 1 + %Y.neg.ra = add i32 %A, %X + %r = add i32 %A.neg, %Y.neg.ra + ret i32 %r +} +