[llvm-commits] [parallel] CVS: llvm/test/Regression/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll call-intrinsics.ll canonicalize_branch.ll 2002-08-02-CastTest.ll add.ll call.ll cast.ll getelementptr.ll malloc.ll mul.ll not.ll phi.ll sub.ll xor.ll

Misha Brukman brukman at cs.uiuc.edu
Mon Mar 1 19:14:54 PST 2004


Changes in directory llvm/test/Regression/Transforms/InstCombine:

2004-02-23-ShiftShiftOverflow.ll added (r1.2.2.1)
call-intrinsics.ll added (r1.1.2.1)
canonicalize_branch.ll added (r1.1.2.1)
2002-08-02-CastTest.ll updated: 1.5 -> 1.5.6.1
add.ll updated: 1.16 -> 1.16.6.1
call.ll updated: 1.4 -> 1.4.6.1
cast.ll updated: 1.16 -> 1.16.4.1
getelementptr.ll updated: 1.12 -> 1.12.6.1
malloc.ll updated: 1.2 -> 1.2.6.1
mul.ll updated: 1.10 -> 1.10.6.1
not.ll updated: 1.10 -> 1.10.6.1
phi.ll updated: 1.7 -> 1.7.6.1
sub.ll updated: 1.13 -> 1.13.6.1
xor.ll updated: 1.10 -> 1.10.4.1

---
Log message:

Merge from trunk

---
Diffs of the changes:  (+142 -9)

Index: llvm/test/Regression/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll
diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll:1.2.2.1
*** /dev/null	Mon Mar  1 17:59:24 2004
--- llvm/test/Regression/Transforms/InstCombine/2004-02-23-ShiftShiftOverflow.ll	Mon Mar  1 17:59:14 2004
***************
*** 0 ****
--- 1,15 ----
+ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 34
+ 
+ int %test(int %X) {
+ 	; Do not fold into shr X, 34, as this uses undefined behavior!
+ 	%Y = shr int %X, ubyte 17
+ 	%Z = shr int %Y, ubyte 17
+ 	ret int %Z
+ }
+ 
+ int %test2(int %X) {
+ 	; Do not fold into shl X, 34, as this uses undefined behavior!
+ 	%Y = shl int %X, ubyte 17
+ 	%Z = shl int %Y, ubyte 17
+ 	ret int %Z
+ }


Index: llvm/test/Regression/Transforms/InstCombine/call-intrinsics.ll
diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/call-intrinsics.ll:1.1.2.1
*** /dev/null	Mon Mar  1 17:59:24 2004
--- llvm/test/Regression/Transforms/InstCombine/call-intrinsics.ll	Mon Mar  1 17:59:14 2004
***************
*** 0 ****
--- 1,17 ----
+ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis
+ 
+ declare void %llvm.memmove(sbyte*, sbyte*, uint, uint)
+ declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint)
+ declare void %llvm.memset(sbyte*, ubyte, uint, uint)
+ 
+ %X = global sbyte 0
+ %Y = global sbyte 12
+ 
+ void %zero_byte_test() {
+   ; These process zero bytes, so they are a noop.
+   call void %llvm.memmove(sbyte* %X, sbyte* %Y, uint 0, uint 100)
+   call void %llvm.memcpy(sbyte* %X, sbyte* %Y, uint 0, uint 100)
+   call void %llvm.memset(sbyte* %X, ubyte 123, uint 0, uint 100)
+   ret void
+ }
+ 


Index: llvm/test/Regression/Transforms/InstCombine/canonicalize_branch.ll
diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/canonicalize_branch.ll:1.1.2.1
*** /dev/null	Mon Mar  1 17:59:24 2004
--- llvm/test/Regression/Transforms/InstCombine/canonicalize_branch.ll	Mon Mar  1 17:59:14 2004
***************
*** 0 ****
--- 1,27 ----
+ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'setne\|setle\|setge'
+ 
+ int %test1(uint %X, uint %Y) {
+ 	%C = setne uint %X, %Y
+ 	br bool %C, label %T, label %F
+ T:
+ 	ret int 12
+ F:
+ 	ret int 123
+ }
+ 
+ int %test2(uint %X, uint %Y) {
+ 	%C = setle uint %X, %Y
+ 	br bool %C, label %T, label %F
+ T:
+ 	ret int 12
+ F:
+ 	ret int 123
+ }
+ int %test3(uint %X, uint %Y) {
+ 	%C = setge uint %X, %Y
+ 	br bool %C, label %T, label %F
+ T:
+ 	ret int 12
+ F:
+ 	ret int 123
+ }


Index: llvm/test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll
diff -u llvm/test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll:1.5 llvm/test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll:1.5.6.1
--- llvm/test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll:1.5	Tue Sep 16 10:29:33 2003
+++ llvm/test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll	Mon Mar  1 17:59:14 2004
@@ -1,7 +1,7 @@
 ; This testcase is incorrectly getting completely eliminated.  There should be
 ; SOME instruction named %c here, even if it's a bitwise and.
 ;
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep '%c'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep '%c'
 ;
 ulong %test3(ulong %A) {
         %c1 = cast ulong %A to ubyte


Index: llvm/test/Regression/Transforms/InstCombine/add.ll
diff -u llvm/test/Regression/Transforms/InstCombine/add.ll:1.16 llvm/test/Regression/Transforms/InstCombine/add.ll:1.16.6.1
--- llvm/test/Regression/Transforms/InstCombine/add.ll:1.16	Thu Oct  2 10:11:09 2003
+++ llvm/test/Regression/Transforms/InstCombine/add.ll	Mon Mar  1 17:59:14 2004
@@ -1,6 +1,6 @@
 ; This test makes sure that add instructions are properly eliminated.
 
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep -v OK | not grep add
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v OK | not grep add
 
 implementation
 


Index: llvm/test/Regression/Transforms/InstCombine/call.ll
diff -u llvm/test/Regression/Transforms/InstCombine/call.ll:1.4 llvm/test/Regression/Transforms/InstCombine/call.ll:1.4.6.1
--- llvm/test/Regression/Transforms/InstCombine/call.ll:1.4	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/call.ll	Mon Mar  1 17:59:14 2004
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep call | not grep cast
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep call | not grep cast
 
 implementation
 


Index: llvm/test/Regression/Transforms/InstCombine/cast.ll
diff -u llvm/test/Regression/Transforms/InstCombine/cast.ll:1.16 llvm/test/Regression/Transforms/InstCombine/cast.ll:1.16.4.1
--- llvm/test/Regression/Transforms/InstCombine/cast.ll:1.16	Sat Nov  1 23:56:58 2003
+++ llvm/test/Regression/Transforms/InstCombine/cast.ll	Mon Mar  1 17:59:14 2004
@@ -1,6 +1,8 @@
 ; Tests to make sure elimination of casts is working correctly
 
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep '%c' | not grep cast
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep '%c' | not grep cast
+
+%inbuf = external global [32832 x ubyte]
 
 implementation
 
@@ -79,3 +81,21 @@
 	%c = cast [4 x sbyte]* %p to int*
 	ret int* %c
 }
+
+ubyte *%test13(long %A) {
+	%c = getelementptr [0 x ubyte]* cast ([32832 x ubyte]*  %inbuf to [0 x ubyte]*), long 0, long %A
+	ret ubyte* %c
+}
+
+bool %test14(sbyte %A) {
+        %B = cast sbyte %A to ubyte
+        %X = setlt ubyte %B, 128   ; setge %A, 0
+        ret bool %X
+}
+
+bool %test15(ubyte %A) {
+        %B = cast ubyte %A to sbyte
+        %X = setlt sbyte %B, 0   ; setgt %A, 127
+        ret bool %X
+}
+


Index: llvm/test/Regression/Transforms/InstCombine/getelementptr.ll
diff -u llvm/test/Regression/Transforms/InstCombine/getelementptr.ll:1.12 llvm/test/Regression/Transforms/InstCombine/getelementptr.ll:1.12.6.1
--- llvm/test/Regression/Transforms/InstCombine/getelementptr.ll:1.12	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/getelementptr.ll	Mon Mar  1 17:59:14 2004
@@ -1,6 +1,6 @@
 ; The %A getelementptr instruction should be eliminated here
 
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep getelementptr | not grep '%A '
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr | not grep '%A '
 
 %Global = constant [10 x sbyte] c"helloworld"
 


Index: llvm/test/Regression/Transforms/InstCombine/malloc.ll
diff -u llvm/test/Regression/Transforms/InstCombine/malloc.ll:1.2 llvm/test/Regression/Transforms/InstCombine/malloc.ll:1.2.6.1
--- llvm/test/Regression/Transforms/InstCombine/malloc.ll:1.2	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/malloc.ll	Mon Mar  1 17:59:14 2004
@@ -1,5 +1,5 @@
 ; test that malloc's with a constant argument are promoted to array allocations
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep getelementptr
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr
 
 int* %test() {
 	%X = malloc int, uint 4


Index: llvm/test/Regression/Transforms/InstCombine/mul.ll
diff -u llvm/test/Regression/Transforms/InstCombine/mul.ll:1.10 llvm/test/Regression/Transforms/InstCombine/mul.ll:1.10.6.1
--- llvm/test/Regression/Transforms/InstCombine/mul.ll:1.10	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/mul.ll	Mon Mar  1 17:59:14 2004
@@ -50,3 +50,25 @@
 	%j = mul uint %i, 4294967295    ; %j = sub 0, %i
 	ret uint %j
 }
+
+uint %test10(int %a, uint %b) {
+	%c = setlt int %a, 0
+	%d = cast bool %c to uint
+	%e = mul uint %d, %b           ; e = b & (a >> 31)
+	ret uint %e
+}
+
+uint %test11(int %a, uint %b) {
+	%c = setle int %a, -1
+	%d = cast bool %c to uint
+	%e = mul uint %d, %b           ; e = b & (a >> 31)
+	ret uint %e
+}
+
+uint %test11(ubyte %a, uint %b) {
+	%c = setgt ubyte %a, 127
+	%d = cast bool %c to uint
+	%e = mul uint %d, %b           ; e = b & (a >> 31)
+	ret uint %e
+}
+


Index: llvm/test/Regression/Transforms/InstCombine/not.ll
diff -u llvm/test/Regression/Transforms/InstCombine/not.ll:1.10 llvm/test/Regression/Transforms/InstCombine/not.ll:1.10.6.1
--- llvm/test/Regression/Transforms/InstCombine/not.ll:1.10	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/not.ll	Mon Mar  1 17:59:14 2004
@@ -1,7 +1,7 @@
 ; This test makes sure that these instructions are properly eliminated.
 ;
 
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | not grep xor
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep xor
 
 implementation
 


Index: llvm/test/Regression/Transforms/InstCombine/phi.ll
diff -u llvm/test/Regression/Transforms/InstCombine/phi.ll:1.7 llvm/test/Regression/Transforms/InstCombine/phi.ll:1.7.6.1
--- llvm/test/Regression/Transforms/InstCombine/phi.ll:1.7	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/phi.ll	Mon Mar  1 17:59:14 2004
@@ -1,7 +1,7 @@
 ; This test makes sure that these instructions are properly eliminated.
 ;
 
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | not grep phi
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep phi
 
 implementation
 
@@ -41,5 +41,17 @@
         br bool %b, label %L2, label %Loop
 L2:
 	br label %Loop
+}
+
+bool %test4(bool %A) {
+	br bool %A, label %BB1, label %BB2
+BB1:
+	br label %Ret
+BB2:
+	br label %Ret
+Ret:
+	%B = phi int [1000, %BB1], [123, %BB2]
+	%C = cast int %B to bool
+	ret bool %C
 }
 


Index: llvm/test/Regression/Transforms/InstCombine/sub.ll
diff -u llvm/test/Regression/Transforms/InstCombine/sub.ll:1.13 llvm/test/Regression/Transforms/InstCombine/sub.ll:1.13.6.1
--- llvm/test/Regression/Transforms/InstCombine/sub.ll:1.13	Tue Sep 16 10:29:34 2003
+++ llvm/test/Regression/Transforms/InstCombine/sub.ll	Mon Mar  1 17:59:14 2004
@@ -1,7 +1,7 @@
 ; This test makes sure that these instructions are properly eliminated.
 ;
 
-; RUN: llvm-as < %s | opt -instcombine -die | llvm-dis | grep sub | not grep -v 'sub int %Cok, %Bok'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep sub | not grep -v 'sub int %Cok, %Bok'
 
 implementation
 


Index: llvm/test/Regression/Transforms/InstCombine/xor.ll
diff -u llvm/test/Regression/Transforms/InstCombine/xor.ll:1.10 llvm/test/Regression/Transforms/InstCombine/xor.ll:1.10.4.1
--- llvm/test/Regression/Transforms/InstCombine/xor.ll:1.10	Tue Nov  4 19:05:22 2003
+++ llvm/test/Regression/Transforms/InstCombine/xor.ll	Mon Mar  1 17:59:14 2004
@@ -3,6 +3,9 @@
 
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor '
 
+%G1 = global uint 0
+%G2 = global uint 0
+
 implementation
 
 bool %test0(bool %A) {
@@ -122,3 +125,20 @@
 	%C = sub uint 123, %B
 	ret uint %C
 }
+
+uint %test19(uint %A, uint %B) {
+	%C = xor uint %A, %B
+	%D = xor uint %C, %A  ; A terms cancel, D = B
+	ret uint %D
+}
+
+void %test20(uint %A, uint %B) {  ; The "swap idiom"
+        %tmp.2 = xor uint %B, %A
+        %tmp.5 = xor uint %tmp.2, %B
+        %tmp.8 = xor uint %tmp.5, %tmp.2
+        store uint %tmp.8, uint* %G1   ; tmp.8 = B
+        store uint %tmp.5, uint* %G2   ; tmp.5 = A
+        ret void
+}
+
+





More information about the llvm-commits mailing list