[llvm-commits] [llvm] r92352 - in /llvm/trunk/test/Transforms/Reassociate: basictest.ll basictest2.ll basictest3.ll basictest4.ll
Chris Lattner
sabre at nondot.org
Thu Dec 31 00:29:56 PST 2009
Author: lattner
Date: Thu Dec 31 02:29:56 2009
New Revision: 92352
URL: http://llvm.org/viewvc/llvm-project?rev=92352&view=rev
Log:
filecheckize
Removed:
llvm/trunk/test/Transforms/Reassociate/basictest2.ll
llvm/trunk/test/Transforms/Reassociate/basictest3.ll
llvm/trunk/test/Transforms/Reassociate/basictest4.ll
Modified:
llvm/trunk/test/Transforms/Reassociate/basictest.ll
Modified: llvm/trunk/test/Transforms/Reassociate/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest.ll?rev=92352&r1=92351&r2=92352&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/basictest.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/basictest.ll Thu Dec 31 02:29:56 2009
@@ -1,10 +1,107 @@
; With reassociation, constant folding can eliminate the 12 and -12 constants.
;
-; RUN: opt < %s -reassociate -constprop -instcombine -die -S | not grep add
+; RUN: opt < %s -reassociate -gvn -instcombine -S | FileCheck %s
-define i32 @test(i32 %arg) {
- %tmp1 = sub i32 -12, %arg ; <i32> [#uses=1]
- %tmp2 = add i32 %tmp1, 12 ; <i32> [#uses=1]
+define i32 @test1(i32 %arg) {
+ %tmp1 = sub i32 -12, %arg
+ %tmp2 = add i32 %tmp1, 12
ret i32 %tmp2
+; CHECK: @test1
+; CHECK-NEXT: sub i32 0, %arg
+; CHECK-NEXT: ret i32
}
+define i32 @test2(i32 %reg109, i32 %reg1111) {
+ %reg115 = add i32 %reg109, -30 ; <i32> [#uses=1]
+ %reg116 = add i32 %reg115, %reg1111 ; <i32> [#uses=1]
+ %reg117 = add i32 %reg116, 30 ; <i32> [#uses=1]
+ ret i32 %reg117
+; CHECK: @test2
+; CHECK-NEXT: add i32 %reg1111, %reg109
+; CHECK-NEXT: ret i32
+}
+
+ at e = external global i32 ; <i32*> [#uses=3]
+ at a = external global i32 ; <i32*> [#uses=3]
+ at b = external global i32 ; <i32*> [#uses=3]
+ at c = external global i32 ; <i32*> [#uses=3]
+ at f = external global i32 ; <i32*> [#uses=3]
+
+define void @test3() {
+ %A = load i32* @a ; <i32> [#uses=2]
+ %B = load i32* @b ; <i32> [#uses=2]
+ %C = load i32* @c ; <i32> [#uses=2]
+ %t1 = add i32 %A, %B ; <i32> [#uses=1]
+ %t2 = add i32 %t1, %C ; <i32> [#uses=1]
+ %t3 = add i32 %C, %A ; <i32> [#uses=1]
+ %t4 = add i32 %t3, %B ; <i32> [#uses=1]
+ ; e = (a+b)+c;
+ store i32 %t2, i32* @e
+ ; f = (a+c)+b
+ store i32 %t4, i32* @f
+ ret void
+; CHECK: @test3
+; CHECK: add i32
+; CHECK: add i32
+; CHECK-NOT: add i32
+; CHECK: ret void
+}
+
+define void @test4() {
+ %A = load i32* @a ; <i32> [#uses=2]
+ %B = load i32* @b ; <i32> [#uses=2]
+ %C = load i32* @c ; <i32> [#uses=2]
+ %t1 = add i32 %A, %B ; <i32> [#uses=1]
+ %t2 = add i32 %t1, %C ; <i32> [#uses=1]
+ %t3 = add i32 %C, %A ; <i32> [#uses=1]
+ %t4 = add i32 %t3, %B ; <i32> [#uses=1]
+ ; e = c+(a+b)
+ store i32 %t2, i32* @e
+ ; f = (c+a)+b
+ store i32 %t4, i32* @f
+ ret void
+; CHECK: @test4
+; CHECK: add i32
+; CHECK: add i32
+; CHECK-NOT: add i32
+; CHECK: ret void
+}
+
+define void @test5() {
+ %A = load i32* @a ; <i32> [#uses=2]
+ %B = load i32* @b ; <i32> [#uses=2]
+ %C = load i32* @c ; <i32> [#uses=2]
+ %t1 = add i32 %B, %A ; <i32> [#uses=1]
+ %t2 = add i32 %t1, %C ; <i32> [#uses=1]
+ %t3 = add i32 %C, %A ; <i32> [#uses=1]
+ %t4 = add i32 %t3, %B ; <i32> [#uses=1]
+ ; e = c+(b+a)
+ store i32 %t2, i32* @e
+ ; f = (c+a)+b
+ store i32 %t4, i32* @f
+ ret void
+; CHECK: @test5
+; CHECK: add i32
+; CHECK: add i32
+; CHECK-NOT: add i32
+; CHECK: ret void
+}
+
+define i32 @test6() {
+ %tmp.0 = load i32* @a ; <i32> [#uses=2]
+ %tmp.1 = load i32* @b ; <i32> [#uses=2]
+ ; (a+b)
+ %tmp.2 = add i32 %tmp.0, %tmp.1 ; <i32> [#uses=1]
+ %tmp.4 = load i32* @c ; <i32> [#uses=2]
+ ; (a+b)+c
+ %tmp.5 = add i32 %tmp.2, %tmp.4 ; <i32> [#uses=1]
+ ; (a+c)
+ %tmp.8 = add i32 %tmp.0, %tmp.4 ; <i32> [#uses=1]
+ ; (a+c)+b
+ %tmp.11 = add i32 %tmp.8, %tmp.1 ; <i32> [#uses=1]
+ ; X ^ X = 0
+ %RV = xor i32 %tmp.5, %tmp.11 ; <i32> [#uses=1]
+ ret i32 %RV
+; CHECK: @test6
+; CHECK: ret i32 0
+}
Removed: llvm/trunk/test/Transforms/Reassociate/basictest2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest2.ll?rev=92351&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/basictest2.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/basictest2.ll (removed)
@@ -1,11 +0,0 @@
-; With reassociation, constant folding can eliminate the +/- 30 constants.
-;
-; RUN: opt < %s -reassociate -constprop -instcombine -die -S | not grep 30
-
-define i32 @test(i32 %reg109, i32 %reg1111) {
- %reg115 = add i32 %reg109, -30 ; <i32> [#uses=1]
- %reg116 = add i32 %reg115, %reg1111 ; <i32> [#uses=1]
- %reg117 = add i32 %reg116, 30 ; <i32> [#uses=1]
- ret i32 %reg117
-}
-
Removed: llvm/trunk/test/Transforms/Reassociate/basictest3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest3.ll?rev=92351&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/basictest3.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/basictest3.ll (removed)
@@ -1,54 +0,0 @@
-; RUN: opt < %s -reassociate -gvn -S | grep add | count 6
-; Each of these functions should turn into two adds each.
-
- at e = external global i32 ; <i32*> [#uses=3]
- at a = external global i32 ; <i32*> [#uses=3]
- at b = external global i32 ; <i32*> [#uses=3]
- at c = external global i32 ; <i32*> [#uses=3]
- at f = external global i32 ; <i32*> [#uses=3]
-
-define void @test1() {
- %A = load i32* @a ; <i32> [#uses=2]
- %B = load i32* @b ; <i32> [#uses=2]
- %C = load i32* @c ; <i32> [#uses=2]
- %t1 = add i32 %A, %B ; <i32> [#uses=1]
- %t2 = add i32 %t1, %C ; <i32> [#uses=1]
- %t3 = add i32 %C, %A ; <i32> [#uses=1]
- %t4 = add i32 %t3, %B ; <i32> [#uses=1]
- ; e = (a+b)+c;
- store i32 %t2, i32* @e
- ; f = (a+c)+b
- store i32 %t4, i32* @f
- ret void
-}
-
-define void @test2() {
- %A = load i32* @a ; <i32> [#uses=2]
- %B = load i32* @b ; <i32> [#uses=2]
- %C = load i32* @c ; <i32> [#uses=2]
- %t1 = add i32 %A, %B ; <i32> [#uses=1]
- %t2 = add i32 %t1, %C ; <i32> [#uses=1]
- %t3 = add i32 %C, %A ; <i32> [#uses=1]
- %t4 = add i32 %t3, %B ; <i32> [#uses=1]
- ; e = c+(a+b)
- store i32 %t2, i32* @e
- ; f = (c+a)+b
- store i32 %t4, i32* @f
- ret void
-}
-
-define void @test3() {
- %A = load i32* @a ; <i32> [#uses=2]
- %B = load i32* @b ; <i32> [#uses=2]
- %C = load i32* @c ; <i32> [#uses=2]
- %t1 = add i32 %B, %A ; <i32> [#uses=1]
- %t2 = add i32 %t1, %C ; <i32> [#uses=1]
- %t3 = add i32 %C, %A ; <i32> [#uses=1]
- %t4 = add i32 %t3, %B ; <i32> [#uses=1]
- ; e = c+(b+a)
- store i32 %t2, i32* @e
- ; f = (c+a)+b
- store i32 %t4, i32* @f
- ret void
-}
-
Removed: llvm/trunk/test/Transforms/Reassociate/basictest4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest4.ll?rev=92351&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/basictest4.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/basictest4.ll (removed)
@@ -1,23 +0,0 @@
-; RUN: opt < %s -reassociate -gvn -instcombine -S | not grep add
-
- at a = weak global i32 0 ; <i32*> [#uses=1]
- at b = weak global i32 0 ; <i32*> [#uses=1]
- at c = weak global i32 0 ; <i32*> [#uses=1]
- at d = weak global i32 0 ; <i32*> [#uses=0]
-
-define i32 @foo() {
- %tmp.0 = load i32* @a ; <i32> [#uses=2]
- %tmp.1 = load i32* @b ; <i32> [#uses=2]
- ; (a+b)
- %tmp.2 = add i32 %tmp.0, %tmp.1 ; <i32> [#uses=1]
- %tmp.4 = load i32* @c ; <i32> [#uses=2]
- ; (a+b)+c
- %tmp.5 = add i32 %tmp.2, %tmp.4 ; <i32> [#uses=1]
- ; (a+c)
- %tmp.8 = add i32 %tmp.0, %tmp.4 ; <i32> [#uses=1]
- ; (a+c)+b
- %tmp.11 = add i32 %tmp.8, %tmp.1 ; <i32> [#uses=1]
- ; X ^ X = 0
- %RV = xor i32 %tmp.5, %tmp.11 ; <i32> [#uses=1]
- ret i32 %RV
-}
More information about the llvm-commits
mailing list