Upgrade tests to not use llvm-upgrade.
authorTanya Lattner <tonic@nondot.org>
Wed, 19 Mar 2008 04:36:04 +0000 (04:36 +0000)
committerTanya Lattner <tonic@nondot.org>
Wed, 19 Mar 2008 04:36:04 +0000 (04:36 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48530 91177308-0d34-0410-b5e6-96231b3b80d8

23 files changed:
test/Transforms/Reassociate/2002-05-15-AgressiveSubMove.ll
test/Transforms/Reassociate/2002-05-15-MissedTree.ll
test/Transforms/Reassociate/2002-05-15-SubReassociate.ll
test/Transforms/Reassociate/2002-05-15-SubReassociate2.ll
test/Transforms/Reassociate/2002-07-09-DominanceProblem.ll
test/Transforms/Reassociate/2003-08-12-InfiniteLoop.ll
test/Transforms/Reassociate/2005-08-24-Crash.ll
test/Transforms/Reassociate/2005-09-01-ArrayOutOfBounds.ll
test/Transforms/Reassociate/2006-04-27-ReassociateVector.ll
test/Transforms/Reassociate/basictest.ll
test/Transforms/Reassociate/basictest2.ll
test/Transforms/Reassociate/basictest3.ll
test/Transforms/Reassociate/basictest4.ll
test/Transforms/Reassociate/inverses.ll
test/Transforms/Reassociate/looptest.ll
test/Transforms/Reassociate/mul-factor3.ll
test/Transforms/Reassociate/mul-neg-add.ll
test/Transforms/Reassociate/mulfactor.ll
test/Transforms/Reassociate/mulfactor2.ll
test/Transforms/Reassociate/negation.ll
test/Transforms/Reassociate/otherops.ll
test/Transforms/Reassociate/shift-factor.ll
test/Transforms/Reassociate/shifttest.ll

index a7b0df1e8bef1c6316a7b3ca2164aed139c3d7bc..5465418d00ded7196e7a78dcffec331bde91cf66 100644 (file)
@@ -1,8 +1,9 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine -constprop -dce | llvm-dis | not grep add
+; RUN: llvm-as < %s | opt -reassociate -instcombine -constprop -dce | llvm-dis | not grep add
 
-int %test(int %A) {
-       %X = add int %A, 1
-       %Y = add int %A, 1
-       %r = sub int %X, %Y
-       ret int %r               ; Should be equal to 0!
+define i32 @test(i32 %A) {
+       %X = add i32 %A, 1              ; <i32> [#uses=1]
+       %Y = add i32 %A, 1              ; <i32> [#uses=1]
+       %r = sub i32 %X, %Y             ; <i32> [#uses=1]
+       ret i32 %r
 }
+
index 176948a7f9b7ae03b542d5b832b47d226585eedb..79afb6e64c1393431f14f7f5e708d61484ad2635 100644 (file)
@@ -1,8 +1,9 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine -constprop -die | llvm-dis | not grep 5
+; RUN: llvm-as < %s | opt -reassociate -instcombine -constprop -die | llvm-dis | not grep 5
 
-int %test(int %A, int %B) {
-        %W = add int %B, -5
-        %Y = add int %A, 5
-        %Z = add int %W, %Y
-        ret int %Z
+define i32 @test(i32 %A, i32 %B) {
+       %W = add i32 %B, -5             ; <i32> [#uses=1]
+       %Y = add i32 %A, 5              ; <i32> [#uses=1]
+       %Z = add i32 %W, %Y             ; <i32> [#uses=1]
+       ret i32 %Z
 }
+
index be204e92142d8dd65889d8e134af3d475c02fa52..de0666e956177b1a995b3d496ea45fa63e1c3878 100644 (file)
@@ -1,11 +1,12 @@
 ; With sub reassociation, constant folding can eliminate all of the constants.
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -dce | llvm-dis | not grep add
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -dce | llvm-dis | not grep add
 
-int %test(int %A, int %B) {
-       %W = add int 5, %B
-       %X = add int -7, %A
-       %Y = sub int %X, %W
-       %Z = add int %Y, 12
-       ret int %Z
+define i32 @test(i32 %A, i32 %B) {
+       %W = add i32 5, %B              ; <i32> [#uses=1]
+       %X = add i32 -7, %A             ; <i32> [#uses=1]
+       %Y = sub i32 %X, %W             ; <i32> [#uses=1]
+       %Z = add i32 %Y, 12             ; <i32> [#uses=1]
+       ret i32 %Z
 }
+
index c46cc2ebb1caef207cb90adb7666eeb2194a4909..070080acf24fdb8bc1a5b0a3d3a53b3768e4b3c9 100644 (file)
@@ -1,12 +1,13 @@
 ; With sub reassociation, constant folding can eliminate the two 12 constants.
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -dce | llvm-dis | not grep 12
+; RUN: llvm-as < %s | opt -reassociate -constprop -dce | llvm-dis | not grep 12
 
-int "test"(int %A, int %B, int %C, int %D) {
-       %M = add int %A, 12
-       %N = add int %M, %B
-       %O = add int %N, %C
-       %P = sub int %D, %O
-       %Q = add int %P, 12
-       ret int %Q
+define i32 @test(i32 %A, i32 %B, i32 %C, i32 %D) {
+       %M = add i32 %A, 12             ; <i32> [#uses=1]
+       %N = add i32 %M, %B             ; <i32> [#uses=1]
+       %O = add i32 %N, %C             ; <i32> [#uses=1]
+       %P = sub i32 %D, %O             ; <i32> [#uses=1]
+       %Q = add i32 %P, 12             ; <i32> [#uses=1]
+       ret i32 %Q
 }
+
index 6a0ef53279aa458256d91d9e380f82a0ede27ad4..c19baeaae68f8957c65b10406f85f8f075337d58 100644 (file)
@@ -1,10 +1,10 @@
 ; The reassociate pass is not preserving dominance properties correctly
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate
+; RUN: llvm-as < %s | opt -reassociate
 
-int %compute_dist(int %i, int %j) {
-        %reg119 = sub int %j, %i
-        ret int %reg119
+define i32 @compute_dist(i32 %i, i32 %j) {
+       %reg119 = sub i32 %j, %i                ; <i32> [#uses=1]
+       ret i32 %reg119
 }
 
 
index a84297b8b454229283d023e32a045ddf6bb7b1c2..41cba63d8fdab1686add8afa2dc56b38538cac40 100644 (file)
@@ -1,10 +1,9 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -disable-output
+; RUN: llvm-as < %s | opt -reassociate -disable-output
 
-implementation   ; Functions:
-
-int %test(int %A.1, int %B.1, int %C.1, int %D.1) {
-       %tmp.16 = and int %A.1, %B.1            ; <int> [#uses=1]
-       %tmp.18 = and int %tmp.16, %C.1         ; <int> [#uses=1]
-       %tmp.20 = and int %tmp.18, %D.1         ; <int> [#uses=1]
-       ret int %tmp.20
+define i32 @test(i32 %A.1, i32 %B.1, i32 %C.1, i32 %D.1) {
+       %tmp.16 = and i32 %A.1, %B.1            ; <i32> [#uses=1]
+       %tmp.18 = and i32 %tmp.16, %C.1         ; <i32> [#uses=1]
+       %tmp.20 = and i32 %tmp.18, %D.1         ; <i32> [#uses=1]
+       ret i32 %tmp.20
 }
+
index 7e8e5d5a3f6654c191ae8b5955a57d305a37565e..99c98ef5932cd5c3b93ddb59b02d4e0225a77419 100644 (file)
@@ -1,12 +1,13 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -disable-output
+; RUN: llvm-as < %s | opt -reassociate -disable-output
 
-void %test(int %a, int %b, int %c, int %d) {
-       %tmp.2 = xor int %a, %b         ; <int> [#uses=1]
-       %tmp.5 = xor int %c, %d         ; <int> [#uses=1]
-       %tmp.6 = xor int %tmp.2, %tmp.5         ; <int> [#uses=1]
-       %tmp.9 = xor int %c, %a         ; <int> [#uses=1]
-       %tmp.12 = xor int %b, %d                ; <int> [#uses=1]
-       %tmp.13 = xor int %tmp.9, %tmp.12               ; <int> [#uses=1]
-       %tmp.16 = xor int %tmp.6, %tmp.13               ; <int> [#uses=0]
+define void @test(i32 %a, i32 %b, i32 %c, i32 %d) {
+       %tmp.2 = xor i32 %a, %b         ; <i32> [#uses=1]
+       %tmp.5 = xor i32 %c, %d         ; <i32> [#uses=1]
+       %tmp.6 = xor i32 %tmp.2, %tmp.5         ; <i32> [#uses=1]
+       %tmp.9 = xor i32 %c, %a         ; <i32> [#uses=1]
+       %tmp.12 = xor i32 %b, %d                ; <i32> [#uses=1]
+       %tmp.13 = xor i32 %tmp.9, %tmp.12               ; <i32> [#uses=1]
+       %tmp.16 = xor i32 %tmp.6, %tmp.13               ; <i32> [#uses=0]
        ret void
 }
+
index 7ddad0bd0aa5ea682aee893530814c2a89e6f2eb..d11a2ea767a9aff61f76b1a328452d5226056e74 100644 (file)
@@ -1,22 +1,23 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis |\
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis |\
 ; RUN:   grep {ret i32 0}
 
-int %f(int %a0, int %a1, int %a2, int %a3, int %a4) {
-       %tmp.2 = add int %a4, %a3               ; <int> [#uses=1]
-       %tmp.4 = add int %tmp.2, %a2            ; <int> [#uses=1]
-       %tmp.6 = add int %tmp.4, %a1            ; <int> [#uses=1]
-       %tmp.8 = add int %tmp.6, %a0            ; <int> [#uses=1]
-       %tmp.11 = add int %a3, %a2              ; <int> [#uses=1]
-       %tmp.13 = add int %tmp.11, %a1          ; <int> [#uses=1]
-       %tmp.15 = add int %tmp.13, %a0          ; <int> [#uses=1]
-       %tmp.18 = add int %a2, %a1              ; <int> [#uses=1]
-       %tmp.20 = add int %tmp.18, %a0          ; <int> [#uses=1]
-       %tmp.23 = add int %a1, %a0              ; <int> [#uses=1]
-       %tmp.26 = sub int %tmp.8, %tmp.15               ; <int> [#uses=1]
-       %tmp.28 = add int %tmp.26, %tmp.20              ; <int> [#uses=1]
-       %tmp.30 = sub int %tmp.28, %tmp.23              ; <int> [#uses=1]
-       %tmp.32 = sub int %tmp.30, %a4          ; <int> [#uses=1]
-       %tmp.34 = sub int %tmp.32, %a2          ; <int> [#uses=2]
-       %T = mul int %tmp.34, %tmp.34
-       ret int %T
+define i32 @f(i32 %a0, i32 %a1, i32 %a2, i32 %a3, i32 %a4) {
+       %tmp.2 = add i32 %a4, %a3               ; <i32> [#uses=1]
+       %tmp.4 = add i32 %tmp.2, %a2            ; <i32> [#uses=1]
+       %tmp.6 = add i32 %tmp.4, %a1            ; <i32> [#uses=1]
+       %tmp.8 = add i32 %tmp.6, %a0            ; <i32> [#uses=1]
+       %tmp.11 = add i32 %a3, %a2              ; <i32> [#uses=1]
+       %tmp.13 = add i32 %tmp.11, %a1          ; <i32> [#uses=1]
+       %tmp.15 = add i32 %tmp.13, %a0          ; <i32> [#uses=1]
+       %tmp.18 = add i32 %a2, %a1              ; <i32> [#uses=1]
+       %tmp.20 = add i32 %tmp.18, %a0          ; <i32> [#uses=1]
+       %tmp.23 = add i32 %a1, %a0              ; <i32> [#uses=1]
+       %tmp.26 = sub i32 %tmp.8, %tmp.15               ; <i32> [#uses=1]
+       %tmp.28 = add i32 %tmp.26, %tmp.20              ; <i32> [#uses=1]
+       %tmp.30 = sub i32 %tmp.28, %tmp.23              ; <i32> [#uses=1]
+       %tmp.32 = sub i32 %tmp.30, %a4          ; <i32> [#uses=1]
+       %tmp.34 = sub i32 %tmp.32, %a2          ; <i32> [#uses=2]
+       %T = mul i32 %tmp.34, %tmp.34           ; <i32> [#uses=1]
+       ret i32 %T
 }
+
index 2a5b5cd9819fd96452559d5b1902c31b78580d6c..05d6103bbfd3d04862b40ca2855b6ad384fe0d7a 100644 (file)
@@ -1,7 +1,8 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -disable-output
+; RUN: llvm-as < %s | opt -reassociate -disable-output
 
-void %foo() {
-       %tmp162 = sub <4 x float> zeroinitializer, zeroinitializer
-       %tmp164 = mul <4 x float> zeroinitializer, %tmp162
+define void @foo() {
+       %tmp162 = sub <4 x float> zeroinitializer, zeroinitializer              ; <<4 x float>> [#uses=1]
+       %tmp164 = mul <4 x float> zeroinitializer, %tmp162              ; <<4 x float>> [#uses=0]
        ret void
 }
+
index a7ff84a65e6a8cfdc58a4249ea1c2e05531825d2..09db47b1907c050a0be52b19e5c2a3cce5d32425 100644 (file)
@@ -1,9 +1,10 @@
 ; With reassociation, constant folding can eliminate the 12 and -12 constants.
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep add
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep add
 
-int %test(int %arg) {
-       %tmp1 = sub int -12, %arg
-       %tmp2 = add int %tmp1, 12
-       ret int %tmp2
+define i32 @test(i32 %arg) {
+       %tmp1 = sub i32 -12, %arg               ; <i32> [#uses=1]
+       %tmp2 = add i32 %tmp1, 12               ; <i32> [#uses=1]
+       ret i32 %tmp2
 }
+
index 7efa3cca81aefbcb730b5558645b391fcc088eef..dbde3af35e1b83c8a990bb4443a1ca1d5b97cc33 100644 (file)
@@ -1,10 +1,11 @@
 ; With reassociation, constant folding can eliminate the +/- 30 constants.
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 30
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 30
 
-int "test"(int %reg109, int %reg1111) {
-        %reg115 = add int %reg109, -30           ; <int> [#uses=1]
-        %reg116 = add int %reg115, %reg1111             ; <int> [#uses=1]
-        %reg117 = add int %reg116, 30           ; <int> [#uses=1]
-        ret int %reg117
+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
 }
+
index 4aa134ae7fb4c716bdd478c443600a95ce5c6b00..71a6cf656d4464d316860270d4a5af9db3993b4e 100644 (file)
@@ -1,50 +1,54 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -gcse | llvm-dis | grep add | count 6
+; RUN: llvm-as < %s | opt -reassociate -gcse | llvm-dis | grep add | count 6
 ; Each of these functions should turn into two adds each.
 
-%e = external global int
-%a = external global int
-%b = external global int
-%c = external global int
-%f = external global int
+@e = external global i32               ; <i32*> [#uses=3]
+@a = external global i32               ; <i32*> [#uses=3]
+@b = external global i32               ; <i32*> [#uses=3]
+@c = external global i32               ; <i32*> [#uses=3]
+@f = external global i32               ; <i32*> [#uses=3]
 
-implementation
-
-void %test1() {
-        %A = load int* %a
-        %B = load int* %b
-        %C = load int* %c
-        %t1 = add int %A, %B
-       %t2 = add int %t1, %C
-        %t3 = add int %C, %A
-       %t4 = add int %t3, %B
-        store int %t2, int* %e  ; e = (a+b)+c;
-        store int %t4, int* %f  ; f = (a+c)+b
-        ret void
+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
 }
 
-void %test2() {
-        %A = load int* %a
-        %B = load int* %b
-        %C = load int* %c
-       %t1 = add int %A, %B
-       %t2 = add int %t1, %C
-       %t3 = add int %C, %A
-       %t4 = add int %t3, %B
-        store int %t2, int* %e  ; e = c+(a+b)
-        store int %t4, int* %f  ; f = (c+a)+b
-        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
 }
 
-void %test3() {
-        %A = load int* %a
-        %B = load int* %b
-        %C = load int* %c
-       %t1 = add int %B, %A
-       %t2 = add int %t1, %C
-       %t3 = add int %C, %A
-       %t4 = add int %t3, %B
-        store int %t2, int* %e  ; e = c+(b+a)
-        store int %t4, int* %f  ; f = (c+a)+b
-        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
 }
 
index dcf7a55bcd96fe830d74775f3a65f68e38d1c7ef..fbf86a9f583000dbca44e9d3554708df5e305837 100644 (file)
@@ -1,20 +1,23 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -gcse -instcombine | llvm-dis | not grep add
+; RUN: llvm-as < %s | opt -reassociate -gcse -instcombine | llvm-dis | not grep add
 
-%a = weak global int 0
-%b = weak global int 0
-%c = weak global int 0
-%d = weak global int 0
+@a = weak global i32 0         ; <i32*> [#uses=1]
+@b = weak global i32 0         ; <i32*> [#uses=1]
+@c = weak global i32 0         ; <i32*> [#uses=1]
+@d = weak global i32 0         ; <i32*> [#uses=0]
 
-implementation
-
-int %foo() {
-       %tmp.0 = load int* %a
-       %tmp.1 = load int* %b
-       %tmp.2 = add int %tmp.0, %tmp.1   ; (a+b)
-       %tmp.4 = load int* %c
-       %tmp.5 = add int %tmp.2, %tmp.4   ; (a+b)+c
-       %tmp.8 = add int %tmp.0, %tmp.4   ; (a+c)
-       %tmp.11 = add int %tmp.8, %tmp.1  ; (a+c)+b
-       %RV = xor int %tmp.5, %tmp.11     ; X ^ X = 0
-       ret int %RV
+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
 }
index e431328a4816adacc87c08162e476429fe9298b8..5b08d0eec675fd64efc33ad78f869df7cd1c42c2 100644 (file)
@@ -1,25 +1,28 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -dce | llvm-dis | \
+; RUN: llvm-as < %s | opt -reassociate -dce | llvm-dis | \
 ; RUN:   not grep {\\(and\\|sub\\)}
 
-int %test1(int %a, int %b) {
-        %tmp.2 = and int %b, %a
-        %tmp.4 = xor int %a, -1
-        %tmp.5 = and int %tmp.2, %tmp.4 ; (A&B)&~A == 0
-        ret int %tmp.5
+define i32 @test1(i32 %a, i32 %b) {
+       %tmp.2 = and i32 %b, %a         ; <i32> [#uses=1]
+       %tmp.4 = xor i32 %a, -1         ; <i32> [#uses=1]
+        ; (A&B)&~A == 0
+       %tmp.5 = and i32 %tmp.2, %tmp.4         ; <i32> [#uses=1]
+       ret i32 %tmp.5
 }
 
-int %test2(int %a, int %b) {
-       %tmp.1 = and int %a, 1234
-        %tmp.2 = and int %b, %tmp.1
-        %tmp.4 = xor int %a, -1
-        %tmp.5 = and int %tmp.2, %tmp.4 ; A&~A == 0
-        ret int %tmp.5
+define i32 @test2(i32 %a, i32 %b) {
+       %tmp.1 = and i32 %a, 1234               ; <i32> [#uses=1]
+       %tmp.2 = and i32 %b, %tmp.1             ; <i32> [#uses=1]
+       %tmp.4 = xor i32 %a, -1         ; <i32> [#uses=1]
+       ; A&~A == 0
+        %tmp.5 = and i32 %tmp.2, %tmp.4                ; <i32> [#uses=1]
+       ret i32 %tmp.5
 }
 
-int %test3(int %b, int %a) {
-       %tmp.1 = add int %a, 1234
-        %tmp.2 = add int %b, %tmp.1
-        %tmp.4 = sub int 0, %a
-        %tmp.5 = add int %tmp.2, %tmp.4   ; (b+(a+1234))+-a -> b+1234
-        ret int %tmp.5
+define i32 @test3(i32 %b, i32 %a) {
+       %tmp.1 = add i32 %a, 1234               ; <i32> [#uses=1]
+       %tmp.2 = add i32 %b, %tmp.1             ; <i32> [#uses=1]
+       %tmp.4 = sub i32 0, %a          ; <i32> [#uses=1]
+        ; (b+(a+1234))+-a -> b+1234
+       %tmp.5 = add i32 %tmp.2, %tmp.4         ; <i32> [#uses=1]
+       ret i32 %tmp.5
 }
index 97127bb95094be99be4c51e9b420bb8f4424c2c7..3b28c2389538d93317c1462040b53f33682b3c79 100644 (file)
 ; In this case, we want to reassociate the specified expr so that i+j can be
 ; hoisted out of the inner most loop.
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate | llvm-dis | grep 115 | not grep 117
-
-%.LC0 = internal global [4 x sbyte] c"%d\0A\00"                ; <[4 x sbyte]*> [#uses=1]
-
-declare int "printf"(sbyte*, ...)
-
-void "test"(uint %Num, int* %Array) {
-bb0:                                   ;[#uses=1]
-       %cond221 = seteq uint 0, %Num           ; <bool> [#uses=3]
-       br bool %cond221, label %bb7, label %bb2
-
-bb2:                                   ;[#uses=3]
-       %reg115 = phi uint [ %reg120, %bb6 ], [ 0, %bb0 ]               ; <uint> [#uses=2]
-       br bool %cond221, label %bb6, label %bb3
-
-bb3:                                   ;[#uses=3]
-       %reg116 = phi uint [ %reg119, %bb5 ], [ 0, %bb2 ]               ; <uint> [#uses=2]
-       br bool %cond221, label %bb5, label %bb4
-
-bb4:                                   ;[#uses=3]
-       %reg117 = phi uint [ %reg118, %bb4 ], [ 0, %bb3 ]               ; <uint> [#uses=2]
-       %reg113 = add uint %reg115, %reg117             ; <uint> [#uses=1]
-       %reg114 = add uint %reg113, %reg116             ; <uint> [#uses=1]
-       %cast227 = getelementptr [4 x sbyte]* %.LC0, long 0, long 0             ; <sbyte*> [#uses=1]
-       call int (sbyte*, ...)* %printf( sbyte* %cast227, uint %reg114 )                ; <int>:0 [#uses=0]
-       %reg118 = add uint %reg117, 1           ; <uint> [#uses=2]
-       %cond224 = setne uint %reg118, %Num             ; <bool> [#uses=1]
-       br bool %cond224, label %bb4, label %bb5
-
-bb5:                                   ;[#uses=3]
-       %reg119 = add uint %reg116, 1           ; <uint> [#uses=2]
-       %cond225 = setne uint %reg119, %Num             ; <bool> [#uses=1]
-       br bool %cond225, label %bb3, label %bb6
-
-bb6:                                   ;[#uses=3]
-       %reg120 = add uint %reg115, 1           ; <uint> [#uses=2]
-       %cond226 = setne uint %reg120, %Num             ; <bool> [#uses=1]
-       br bool %cond226, label %bb2, label %bb7
-
-bb7:                                   ;[#uses=2]
+; RUN: llvm-as < %s | opt -reassociate | llvm-dis | grep 115 | not grep 117
+; END.
+@.LC0 = internal global [4 x i8] c"%d\0A\00"           ; <[4 x i8]*> [#uses=1]
+
+declare i32 @printf(i8*, ...)
+
+define void @test(i32 %Num, i32* %Array) {
+bb0:
+       %cond221 = icmp eq i32 0, %Num          ; <i1> [#uses=3]
+       br i1 %cond221, label %bb7, label %bb2
+bb2:           ; preds = %bb6, %bb0
+       %reg115 = phi i32 [ %reg120, %bb6 ], [ 0, %bb0 ]                ; <i32> [#uses=2]
+       br i1 %cond221, label %bb6, label %bb3
+bb3:           ; preds = %bb5, %bb2
+       %reg116 = phi i32 [ %reg119, %bb5 ], [ 0, %bb2 ]                ; <i32> [#uses=2]
+       br i1 %cond221, label %bb5, label %bb4
+bb4:           ; preds = %bb4, %bb3
+       %reg117 = phi i32 [ %reg118, %bb4 ], [ 0, %bb3 ]                ; <i32> [#uses=2]
+       %reg113 = add i32 %reg115, %reg117              ; <i32> [#uses=1]
+       %reg114 = add i32 %reg113, %reg116              ; <i32> [#uses=1]
+       %cast227 = getelementptr [4 x i8]* @.LC0, i64 0, i64 0          ; <i8*> [#uses=1]
+       call i32 (i8*, ...)* @printf( i8* %cast227, i32 %reg114 )               ; <i32>:0 [#uses=0]
+       %reg118 = add i32 %reg117, 1            ; <i32> [#uses=2]
+       %cond224 = icmp ne i32 %reg118, %Num            ; <i1> [#uses=1]
+       br i1 %cond224, label %bb4, label %bb5
+bb5:           ; preds = %bb4, %bb3
+       %reg119 = add i32 %reg116, 1            ; <i32> [#uses=2]
+       %cond225 = icmp ne i32 %reg119, %Num            ; <i1> [#uses=1]
+       br i1 %cond225, label %bb3, label %bb6
+bb6:           ; preds = %bb5, %bb2
+       %reg120 = add i32 %reg115, 1            ; <i32> [#uses=2]
+       %cond226 = icmp ne i32 %reg120, %Num            ; <i1> [#uses=1]
+       br i1 %cond226, label %bb2, label %bb7
+bb7:           ; preds = %bb6, %bb0
        ret void
 }
index c6aeedefcf48bfa2b03d75d1b236ce64cdfd9e6c..e45e431df54510ece6252f102c6575ed2c06ee25 100644 (file)
@@ -1,16 +1,16 @@
 ; This should be one add and two multiplies.
 
-; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: llvm-as < %s | \
 ; RUN:   opt -reassociate -instcombine | llvm-dis > %t 
 ; RUN: grep mul %t | count 2
 ; RUN: grep add %t | count 1
 
-int %test(int %A, int %B, int %C) {
-       %aa = mul int %A, %A
-       %aab = mul int %aa, %B
-
-       %ac = mul int %A, %C
-       %aac = mul int %ac, %A
-       %r = add int %aab, %aac
-       ret int %r
+define i32 @test(i32 %A, i32 %B, i32 %C) {
+       %aa = mul i32 %A, %A            ; <i32> [#uses=1]
+       %aab = mul i32 %aa, %B          ; <i32> [#uses=1]
+       %ac = mul i32 %A, %C            ; <i32> [#uses=1]
+       %aac = mul i32 %ac, %A          ; <i32> [#uses=1]
+       %r = add i32 %aab, %aac         ; <i32> [#uses=1]
+       ret i32 %r
 }
+
index 4219044dc7ac73148fc52cd2e63fecf49a27e8b4..1899be79e11210e69bf92fafee9656fdf22f0649 100644 (file)
@@ -1,9 +1,10 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis |\
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis |\
 ; RUN:   not grep {sub i32 0}
 
-int %test(int %X, int %Y, int %Z) {
-       %A = sub int 0, %X
-       %B = mul int %A, %Y
-       %C = add int %B, %Z   ; (-X)*Y + Z -> Z-X*Y
-       ret int %C
+define i32 @test(i32 %X, i32 %Y, i32 %Z) {
+       %A = sub i32 0, %X              ; <i32> [#uses=1]
+       %B = mul i32 %A, %Y             ; <i32> [#uses=1]
+        ; (-X)*Y + Z -> Z-X*Y
+       %C = add i32 %B, %Z             ; <i32> [#uses=1]
+       ret i32 %C
 }
index 91667a4c54bcbf651d27c6e6783bbf9edbf9356c..f80019c95e36a17aeb51bda93e3aafc38c0aad38 100644 (file)
@@ -1,14 +1,14 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis | grep mul | count 2
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep mul | count 2
 
 ; This should have exactly 2 multiplies when we're done.
 
-int %f(int %a, int %b) {
-        %tmp.2 = mul int %a, %a
-        %tmp.5 = shl int %a, ubyte 1
-        %tmp.6 = mul int %tmp.5, %b
-        %tmp.10 = mul int %b, %b
-        %tmp.7 = add int %tmp.6, %tmp.2
-        %tmp.11 = add int %tmp.7, %tmp.10
-        ret int %tmp.11
+define i32 @f(i32 %a, i32 %b) {
+       %tmp.2 = mul i32 %a, %a         ; <i32> [#uses=1]
+       %tmp.5 = shl i32 %a, 1          ; <i32> [#uses=1]
+       %tmp.6 = mul i32 %tmp.5, %b             ; <i32> [#uses=1]
+       %tmp.10 = mul i32 %b, %b                ; <i32> [#uses=1]
+       %tmp.7 = add i32 %tmp.6, %tmp.2         ; <i32> [#uses=1]
+       %tmp.11 = add i32 %tmp.7, %tmp.10               ; <i32> [#uses=1]
+       ret i32 %tmp.11
 }
 
index 61c9f0444ac2877bcbd864e461cf9f0b3e137dfd..11fe2e04084e2ef6e11e85f5043093948c6c56e5 100644 (file)
@@ -1,16 +1,16 @@
 ; This should turn into one multiply and one add.
 
-; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: llvm-as < %s | \
 ; RUN:   opt -instcombine -reassociate -instcombine | llvm-dis -o %t 
 ; RUN: grep mul %t | count 1
 ; RUN: grep add %t | count 1
 
-int %main(int %t) {
-        %tmp.3 = mul int %t, 12         ; <int> [#uses=1]
-        %tmp.4 = add int %tmp.3, 5              ; <int> [#uses=1]
-        %tmp.6 = mul int %t, 6          ; <int> [#uses=1]
-        %tmp.8 = mul int %tmp.4, 3              ; <int> [#uses=1]
-        %tmp.9 = add int %tmp.8, %tmp.6         ; <int> [#uses=1]
-        ret int %tmp.9
+define i32 @main(i32 %t) {
+       %tmp.3 = mul i32 %t, 12         ; <i32> [#uses=1]
+       %tmp.4 = add i32 %tmp.3, 5              ; <i32> [#uses=1]
+       %tmp.6 = mul i32 %t, 6          ; <i32> [#uses=1]
+       %tmp.8 = mul i32 %tmp.4, 3              ; <i32> [#uses=1]
+       %tmp.9 = add i32 %tmp.8, %tmp.6         ; <i32> [#uses=1]
+       ret i32 %tmp.9
 }
 
index 56e087a1fc75354a5d526680de6ea68e12e0bccf..6b2041898a1d3f0ab61813b12c44657d34eaaa52 100644 (file)
@@ -1,20 +1,21 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis | not grep sub
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | not grep sub
 
 ; Test that we can turn things like X*-(Y*Z) -> X*-1*Y*Z.
 
-int %test1(int %a, int %b, int %z) {
-       %c = sub int 0, %z
-       %d = mul int %a, %b
-       %e = mul int %c, %d
-       %f = mul int %e, 12345
-       %g = sub int 0, %f
-       ret int %g
+define i32 @test1(i32 %a, i32 %b, i32 %z) {
+       %c = sub i32 0, %z              ; <i32> [#uses=1]
+       %d = mul i32 %a, %b             ; <i32> [#uses=1]
+       %e = mul i32 %c, %d             ; <i32> [#uses=1]
+       %f = mul i32 %e, 12345          ; <i32> [#uses=1]
+       %g = sub i32 0, %f              ; <i32> [#uses=1]
+       ret i32 %g
 }
 
-int %test2(int %a, int %b, int %z) {
-       %d = mul int %z, 40
-       %c = sub int 0, %d
-       %e = mul int %a, %c
-       %f = sub int 0, %e
-       ret int %f
+define i32 @test2(i32 %a, i32 %b, i32 %z) {
+       %d = mul i32 %z, 40             ; <i32> [#uses=1]
+       %c = sub i32 0, %d              ; <i32> [#uses=1]
+       %e = mul i32 %a, %c             ; <i32> [#uses=1]
+       %f = sub i32 0, %e              ; <i32> [#uses=1]
+       ret i32 %f
 }
+
index 9e99d2c858910865d840ba6889ac8562a6fcb72b..3c9b0744a8fc56d57cb700a7f6275cbd6e855b80 100644 (file)
@@ -1,28 +1,28 @@
 ; Reassociation should apply to Add, Mul, And, Or, & Xor
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 12
+; RUN: llvm-as < %s | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 12
 
-int "test_mul"(int %arg) {
-        %tmp1 = mul int 12, %arg
-        %tmp2 = mul int %tmp1, 12
-        ret int %tmp2
+define i32 @test_mul(i32 %arg) {
+       %tmp1 = mul i32 12, %arg                ; <i32> [#uses=1]
+       %tmp2 = mul i32 %tmp1, 12               ; <i32> [#uses=1]
+       ret i32 %tmp2
 }
 
-int "test_and"(int %arg) {
-       %tmp1 = and int 14, %arg
-       %tmp2 = and int %tmp1, 14
-       ret int %tmp2
+define i32 @test_and(i32 %arg) {
+       %tmp1 = and i32 14, %arg                ; <i32> [#uses=1]
+       %tmp2 = and i32 %tmp1, 14               ; <i32> [#uses=1]
+       ret i32 %tmp2
 }
 
-int "test_or"(int %arg) {
-        %tmp1 = or int 14, %arg
-        %tmp2 = or int %tmp1, 14
-        ret int %tmp2
+define i32 @test_or(i32 %arg) {
+       %tmp1 = or i32 14, %arg         ; <i32> [#uses=1]
+       %tmp2 = or i32 %tmp1, 14                ; <i32> [#uses=1]
+       ret i32 %tmp2
 }
 
-int "test_xor"(int %arg) {
-        %tmp1 = xor int 12, %arg
-        %tmp2 = xor int %tmp1, 12
-        ret int %tmp2
+define i32 @test_xor(i32 %arg) {
+       %tmp1 = xor i32 12, %arg                ; <i32> [#uses=1]
+       %tmp2 = xor i32 %tmp1, 12               ; <i32> [#uses=1]
+       ret i32 %tmp2
 }
 
index b381d45f7988113d877fb65a86ff05a80e629459..05437fd866390d9157906bd76f5d37c8b74ebf3a 100644 (file)
@@ -1,13 +1,13 @@
 ; There should be exactly one shift and one add left.
-; RUN: llvm-upgrade < %s | llvm-as | \
+; RUN: llvm-as < %s | \
 ; RUN:   opt -reassociate -instcombine | llvm-dis > %t  
 ; RUN: grep shl %t | count 1
 ; RUN: grep add %t | count 1
 
-int %test(int %X, int %Y) {
-        %tmp.2 = shl int %X, ubyte 1            ; <int> [#uses=1]
-        %tmp.6 = shl int %Y, ubyte 1            ; <int> [#uses=1]
-        %tmp.4 = add int %tmp.6, %tmp.2         ; <int> [#uses=1]
-        ret int %tmp.4
+define i32 @test(i32 %X, i32 %Y) {
+       %tmp.2 = shl i32 %X, 1          ; <i32> [#uses=1]
+       %tmp.6 = shl i32 %Y, 1          ; <i32> [#uses=1]
+       %tmp.4 = add i32 %tmp.6, %tmp.2         ; <i32> [#uses=1]
+       ret i32 %tmp.4
 }
 
index 3603604caabcacdaee2f63598377f65fa3fe9356..fd49e7d3f22320965a863d004a1464a65e61fee1 100644 (file)
@@ -1,11 +1,12 @@
 ; With shl->mul reassociation, we can see that this is (shl A, 9) * A
 ;
-; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis |\
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis |\
 ; RUN:    grep {shl .*, 9}
 
-int %test(int %A, int %B) {
-       %X = shl int %A, ubyte 5
-       %Y = shl int %A, ubyte 4
-       %Z = mul int %Y, %X
-       ret int %Z
+define i32 @test(i32 %A, i32 %B) {
+       %X = shl i32 %A, 5              ; <i32> [#uses=1]
+       %Y = shl i32 %A, 4              ; <i32> [#uses=1]
+       %Z = mul i32 %Y, %X             ; <i32> [#uses=1]
+       ret i32 %Z
 }
+