Remove explicit control flow through the use of the 'not' script

llvm-svn: 6965
This commit is contained in:
Chris Lattner 2003-06-28 23:23:34 +00:00
parent 213fbb3bbb
commit a6fee9d6d5
62 changed files with 85 additions and 300 deletions

View File

@ -1,10 +1,7 @@
; Test that GCSE uses ds-aa to do alias analysis, which is capable of ; Test that GCSE uses ds-aa to do alias analysis, which is capable of
; disambiguating some cases. ; disambiguating some cases.
; RUN: if as < %s | opt -ds-aa -load-vn -gcse -instcombine -dce | dis | grep ELIM ; RUN: as < %s | opt -ds-aa -load-vn -gcse -instcombine -dce | dis | not grep ELIM
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%intpair = type {int*, int*} %intpair = type {int*, int*}
implementation implementation

View File

@ -4,10 +4,7 @@
; Check by running globaldce, which will remove the constant if there are ; Check by running globaldce, which will remove the constant if there are
; no references to it! ; no references to it!
; ;
; RUN: if as < %s | opt -globaldce | dis | grep constant ; RUN: as < %s | opt -globaldce | dis | grep-not constant
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
; ;
%v1 = internal constant int 5 %v1 = internal constant int 5
@ -15,7 +12,6 @@
implementation implementation
int "createtask"() int "createtask"()
begin
%v1 = alloca int ;; Alloca should have one use! %v1 = alloca int ;; Alloca should have one use!
%reg112 = load int* %v1 ;; This load should not use the global! %reg112 = load int* %v1 ;; This load should not use the global!
ret int %reg112 ret int %reg112

View File

@ -1,9 +1,6 @@
; This test checks to make sure that constant exprs fold in some simple situations ; This test checks to make sure that constant exprs fold in some simple situations
; RUN: if as < %s | dis | grep cast ; RUN: as < %s | dis | grep-not cast
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%A = global int* cast (sbyte* null to int*) ; Cast null -> fold %A = global int* cast (sbyte* null to int*) ; Cast null -> fold
%B = global int** cast (int** %A to int**) ; Cast to same type -> fold %B = global int** cast (int** %A to int**) ; Cast to same type -> fold

View File

@ -5,10 +5,7 @@
; RUN: echo "implementation internal int %foo() { ret int 7 }" | as > Output/%s.1.bc ; RUN: echo "implementation internal int %foo() { ret int 7 }" | as > Output/%s.1.bc
; RUN: as < %s > Output/%s.2.bc ; RUN: as < %s > Output/%s.2.bc
; RUN: if link Output/%s.[12].bc | dis | grep 'internal' | grep '%foo(' ; RUN: link Output/%s.[12].bc | dis | grep 'internal' | grep-not '%foo('
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation implementation
declare int %foo() declare int %foo()

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -adce -simplifycfg | dis | grep then: ; RUN: as < %s | opt -adce -simplifycfg | dis | not grep then:
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
void %dead_test8(int* %data.1, int %idx.1) { void %dead_test8(int* %data.1, int %idx.1) {
entry: ; No predecessors! entry: ; No predecessors!

View File

@ -1,10 +1,7 @@
; This is the test case taken from Appel's book that illustrates a hard case ; This is the test case taken from Appel's book that illustrates a hard case
; that SCCP gets right, and when followed by ADCE, is completely eliminated ; that SCCP gets right, and when followed by ADCE, is completely eliminated
; ;
; RUN: if as < %s | opt -sccp -adce -simplifycfg | dis | grep br ; RUN: as < %s | opt -sccp -adce -simplifycfg | dis | not grep br
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test function"(int %i0, int %j0) { int "test function"(int %i0, int %j0) {
BB1: BB1:

View File

@ -1,10 +1,7 @@
; This testcase tests for various features the basicaa test should be able to ; This testcase tests for various features the basicaa test should be able to
; determine, as noted in the comments. ; determine, as noted in the comments.
; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep REMOVE ; RUN: as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | not grep REMOVE
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%Global = external global { int } %Global = external global { int }

View File

@ -2,10 +2,7 @@
; disambiguating some obvious cases. All loads should be removable in ; disambiguating some obvious cases. All loads should be removable in
; this testcase. ; this testcase.
; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep load ; RUN: as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | not grep load
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%A = global int 7 %A = global int 7
%B = global int 8 %B = global int 8

View File

@ -3,10 +3,7 @@
; two pointers, then the load should be hoisted, and the store sunk. Thus ; two pointers, then the load should be hoisted, and the store sunk. Thus
; the loop becomes empty and can be deleted by ADCE. ; the loop becomes empty and can be deleted by ADCE.
; RUN: if as < %s | opt -basicaa -licm --adce | dis | grep Loop ; RUN: as < %s | opt -basicaa -licm --adce | dis | not grep Loop
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%A = global int 7 %A = global int 7
%B = global int 8 %B = global int 8

View File

@ -4,10 +4,7 @@
; Fix #2: The unary not instruction now no longer exists. Change to xor. ; Fix #2: The unary not instruction now no longer exists. Change to xor.
; RUN: if as < %s | opt -constprop | dis | grep 'int 0' ; RUN: as < %s | opt -constprop | dis | not grep 'int 0'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test1"() { int "test1"() {
%R = xor int 123, -1 %R = xor int 123, -1

View File

@ -1,9 +1,6 @@
; SetCC on boolean values was not implemented! ; SetCC on boolean values was not implemented!
; RUN: if as < %s | opt -constprop -die | dis | grep 'set' ; RUN: as < %s | opt -constprop -die | dis | not grep 'set'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
bool "test1"() { bool "test1"() {
%A = setle bool true, false %A = setle bool true, false

View File

@ -1,13 +1,9 @@
; This is a basic sanity check for constant propogation. The add instruction ; This is a basic sanity check for constant propogation. The add instruction
; should be eliminated. ; should be eliminated.
; RUN: if as < %s | opt -constprop -die | dis | grep add ; RUN: as < %s | opt -constprop -die | dis | not grep add
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(bool %B) int %test(bool %B) {
begin
br bool %B, label %BB1, label %BB2 br bool %B, label %BB1, label %BB2
BB1: BB1:
%Val = add int 0, 0 %Val = add int 0, 0
@ -17,4 +13,4 @@ BB2:
BB3: BB3:
%Ret = phi int [%Val, %BB1], [1, %BB2] %Ret = phi int [%Val, %BB1], [1, %BB2]
ret int %Ret ret int %Ret
end }

View File

@ -1,9 +1,6 @@
; Ensure constant propogation of logical instructions is working correctly. ; Ensure constant propogation of logical instructions is working correctly.
; RUN: if as < %s | opt -constprop -die | dis | ggrep -E 'and|or|xor' ; RUN: as < %s | opt -constprop -die | dis | not ggrep -E 'and|or|xor'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test1"() { %R = and int 4,1234 ret int %R } int "test1"() { %R = and int 4,1234 ret int %R }

View File

@ -1,9 +1,6 @@
; Ensure constant propogation of 'not' instructions is working correctly. ; Ensure constant propogation of 'not' instructions is working correctly.
; RUN: if as < %s | opt -constprop -die | dis | grep xor ; RUN: as < %s | opt -constprop -die | dis | not grep xor
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test1"() { int "test1"() {
%R = xor int 4, -1 %R = xor int 4, -1

View File

@ -1,13 +1,9 @@
; This is a basic sanity check for constant propogation. The add instruction ; This is a basic sanity check for constant propogation. The add instruction
; should be eliminated. ; should be eliminated.
; RUN: if as < %s | opt -constprop -die | dis | grep phi ; RUN: as < %s | opt -constprop -die | dis | not grep phi
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(bool %B) int %test(bool %B) {
begin
BB0: BB0:
br bool %B, label %BB1, label %BB3 br bool %B, label %BB1, label %BB3
BB1: BB1:
@ -15,4 +11,4 @@ BB1:
BB3: BB3:
%Ret = phi int [1, %BB0], [1, %BB1] %Ret = phi int [1, %BB0], [1, %BB1]
ret int %Ret ret int %Ret
end }

View File

@ -1,26 +1,23 @@
; Ensure constant propogation of remainder instructions is working correctly. ; Ensure constant propagation of remainder instructions is working correctly.
; RUN: if as < %s | opt -constprop -die | dis | grep rem ; RUN: as < %s | opt -constprop -die | dis | not grep rem
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test1"() { int %test1() {
%R = rem int 4, 3 %R = rem int 4, 3
ret int %R ret int %R
} }
int "test2"() { int %test2() {
%R = rem int 123, -23 %R = rem int 123, -23
ret int %R ret int %R
} }
float "test3"() { float %test3() {
%R = rem float 12.45, 123.213 %R = rem float 12.45, 123.213
ret float %R ret float %R
} }
double "test4"() { double %test4() {
%R = rem double 312.20213123, 12.3333412 %R = rem double 312.20213123, 12.3333412
ret double %R ret double %R
} }

View File

@ -12,10 +12,7 @@
; } ; }
; } ; }
; ;
; RUN: if as < %s | opt -cee -simplifycfg | dis | grep bb3 ; RUN: as < %s | opt -cee -simplifycfg | dis | not grep bb3
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation implementation
declare void %bar() declare void %bar()

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -cee -constprop -instcombine -dce | dis | grep 'REMOVE' ; RUN: as < %s | opt -cee -constprop -instcombine -dce | dis | not grep 'REMOVE'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int %test1(int %A) { int %test1(int %A) {
%cond = seteq int %A, 40 %cond = seteq int %A, 40

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -cee -simplifycfg | dis | grep 'REMOVE' ; RUN: as < %s | opt -cee -simplifycfg | dis | not grep 'REMOVE'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation implementation

View File

@ -11,10 +11,7 @@
; ;
; Note that this is a "feature" test, not a correctness test. ; Note that this is a "feature" test, not a correctness test.
; ;
; RUN: if as < %s | opt -cee -simplifycfg | dis | grep cond213 ; RUN: as < %s | opt -cee -simplifycfg | dis | not grep cond213
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
; ;
implementation ; Functions: implementation ; Functions:

View File

@ -1,10 +1,7 @@
; a load or store of a pointer indicates that the pointer is not null. ; a load or store of a pointer indicates that the pointer is not null.
; Any succeeding uses of the pointer should get this info ; Any succeeding uses of the pointer should get this info
; RUN: if as < %s | opt -cee -instcombine -simplifycfg | dis | grep br ; RUN: as < %s | opt -cee -instcombine -simplifycfg | dis | not grep br
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation ; Functions: implementation ; Functions:

View File

@ -11,10 +11,7 @@
; ;
; This should eliminate all BB's except BB0, BB9, BB10 ; This should eliminate all BB's except BB0, BB9, BB10
; ;
; RUN: if as < %s | opt -cee -instcombine -simplifycfg | dis | grep 'bb[2-8]' ; RUN: as < %s | opt -cee -instcombine -simplifycfg | dis | not grep 'bb[2-8]'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation ; Functions: implementation ; Functions:

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -deadargelim | dis | grep DEADARG ; RUN: as < %s | opt -deadargelim | dis | not grep DEADARG
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation implementation

View File

@ -1,16 +1,7 @@
; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved ; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved
; correctly. ; correctly.
; ;
; RUN: if as < %s | opt -funcresolve > /dev/null ; RUN: as < %s | opt -funcresolve | dis | not grep external
; RUN: then echo "opt ok"
; RUN: else exit 1 # Make sure opt doesn't abort!
; RUN: fi
;
; RUN: if as < %s | opt -funcresolve | dis | grep external
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
;
%X = external global [0 x int] %X = external global [0 x int]
%X = global [4 x int] [ int 1, int 2, int 3, int 4 ] %X = global [4 x int] [ int 1, int 2, int 3, int 4 ]

View File

@ -1,10 +1,7 @@
; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved ; Test that: extern int X[] and int X[] = { 1, 2, 3, 4 } are resolved
; correctly. This doesn't have constantexprs ; correctly. This doesn't have constantexprs
; ;
; RUN: if as < %s | opt -funcresolve | dis | grep external ; RUN: as < %s | opt -funcresolve | dis | not grep external
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
; ;
%X = external global [0 x int] %X = external global [0 x int]

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -funcresolve -funcresolve | dis | grep declare ; RUN: as < %s | opt -funcresolve -funcresolve | dis | not grep declare
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
declare void %qsortg(sbyte*, int, int) declare void %qsortg(sbyte*, int, int)

View File

@ -1,12 +1,5 @@
; RUN: if as < %s | opt -funcresolve > /dev/null
; RUN: then echo "opt ok"
; RUN: else exit 1 # Make sure opt doesn't abort!
; RUN: fi
; ;
; RUN: if as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' ; RUN: as < %s | opt -funcresolve -instcombine | dis | not grep '\.\.\.'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
declare int %foo(...) declare int %foo(...)
declare int %foo(int) declare int %foo(int)

View File

@ -1,7 +1,5 @@
; RUN: if as < %s | opt -funcresolve -disable-output 2>&1 | grep WARNING ; RUN: as < %s | opt -funcresolve -disable-output 2>&1 | not grep WARNING
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%__popcount_tab = external constant [0 x ubyte] %__popcount_tab = external constant [0 x ubyte]
%__popcount_tab = constant [4 x ubyte] c"\00\01\01\02" %__popcount_tab = constant [4 x ubyte] c"\00\01\01\02"

View File

@ -1,9 +1,6 @@
; This testcase should not cause a warning! ; This testcase should not cause a warning!
; RUN: if (as < %s | opt -funcresolve -disable-output) 2>&1 | grep 'WARNING' ; RUN: (as < %s | opt -funcresolve -disable-output) 2>&1 | not grep 'WARNING'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%X = internal global float 1.0 %X = internal global float 1.0
%X = internal global int 1 %X = internal global int 1

View File

@ -1,7 +1,5 @@
; RUN: if as < %s | opt -funcresolve | dis | grep declare ; RUN: as < %s | opt -funcresolve | dis | not grep declare
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%Table = constant int(...)* %foo %Table = constant int(...)* %foo
%Table2 = constant [1 x int(...)* ] [ int(...)* %foo ] %Table2 = constant [1 x int(...)* ] [ int(...)* %foo ]

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -funcresolve | dis | grep declare ; RUN: as < %s | opt -funcresolve | dis | not grep declare
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
declare void %test(...) declare void %test(...)

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' | grep call ; RUN: as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' | not grep call
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
declare int %foo(...) declare int %foo(...)

View File

@ -1,14 +1,6 @@
; This shows where the function is called with the prototype indicating a ; This shows where the function is called with the prototype indicating a
; return type exists, but it really doesn't. ; return type exists, but it really doesn't.
; RUN: if as < %s | opt -funcresolve > /dev/null ; RUN: as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' | not grep call
; RUN: then echo "opt ok"
; RUN: else exit 1 # Make sure opt doesn't abort!
; RUN: fi
;
; RUN: if as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' | grep call
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
declare int %foo(...) declare int %foo(...)

View File

@ -1,15 +1,7 @@
; This shows where the function is called with the prototype indicating a ; This shows where the function is called with the prototype indicating a
; return type doesn't exists, but it really does. ; return type doesn't exists, but it really does.
; ;
; RUN: if as < %s | opt -funcresolve > /dev/null ; RUN: as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' | not grep call
; RUN: then echo "opt ok"
; RUN: else exit 1 # Make sure opt doesn't abort!
; RUN: fi
;
; RUN: if as < %s | opt -funcresolve -instcombine | dis | grep '\.\.\.' | grep call
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
declare void %foo(...) declare void %foo(...)

View File

@ -1,10 +1,7 @@
; This entire chain of computation should be optimized away, but ; This entire chain of computation should be optimized away, but
; wasn't because the two multiplies were not detected as being identical. ; wasn't because the two multiplies were not detected as being identical.
; ;
; RUN: if as < %s | opt -gcse -instcombine -dce | dis | grep sub ; RUN: as < %s | opt -gcse -instcombine -dce | dis | not grep sub
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation ; Functions: implementation ; Functions:

View File

@ -1,10 +1,7 @@
; This testcase shows a bug where an common subexpression exists, but there ; This testcase shows a bug where an common subexpression exists, but there
; is no shared dominator block that the expression can be hoisted out to. ; is no shared dominator block that the expression can be hoisted out to.
; ;
; RUN: if as < %s | opt -load-vn -gcse | dis | grep load ; RUN: as < %s | opt -load-vn -gcse | dis | not grep load
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int %test(int* %P) { int %test(int* %P) {
store int 5, int* %P store int 5, int* %P

View File

@ -1,10 +1,7 @@
; This testcase ensures that redundant loads are eliminated when they should ; This testcase ensures that redundant loads are eliminated when they should
; be. All RL variables (redundant loads) should be eliminated. ; be. All RL variables (redundant loads) should be eliminated.
; ;
; RUN: if as < %s | opt -load-vn -gcse | dis | grep %RL ; RUN: as < %s | opt -load-vn -gcse | dis | not grep %RL
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
; ;
int "test1"(int* %P) { int "test1"(int* %P) {
%A = load int* %P %A = load int* %P

View File

@ -1,10 +1,7 @@
; Make sure that functions are removed successfully if they are referred to by ; Make sure that functions are removed successfully if they are referred to by
; a global that is dead. Make sure any globals they refer to die as well. ; a global that is dead. Make sure any globals they refer to die as well.
; RUN: if as < %s | opt -globaldce | dis | grep foo ; RUN: as < %s | opt -globaldce | dis | not grep foo
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%b = internal global int ()* %foo ;; Unused, kills %foo %b = internal global int ()* %foo ;; Unused, kills %foo

View File

@ -1,10 +1,7 @@
; This testcase tests that a worklist is being used, and that globals can be ; This testcase tests that a worklist is being used, and that globals can be
; removed if they are the subject of a constexpr and ConstantPointerRef ; removed if they are the subject of a constexpr and ConstantPointerRef
; RUN: if as < %s | opt -globaldce | dis | grep global ; RUN: as < %s | opt -globaldce | dis | not grep global
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%t0 = internal global [4 x sbyte] c"foo\00" %t0 = internal global [4 x sbyte] c"foo\00"
%t1 = internal global [4 x sbyte] c"bar\00" %t1 = internal global [4 x sbyte] c"bar\00"

View File

@ -1,8 +1,4 @@
; RUN: if as < %s | opt -globaldce | dis | grep global ; RUN: as < %s | opt -globaldce | dis | not grep global
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%X = uninitialized global int %X = uninitialized global int
%Y = internal global int 7 %Y = internal global int 7

View File

@ -3,10 +3,7 @@
; happens because preheader insertion doesn't insert a preheader for this ; happens because preheader insertion doesn't insert a preheader for this
; case... bad. ; case... bad.
; RUN: if as < %s | opt -licm -adce -simplifycfg | dis | grep 'br ' ; RUN: as < %s | opt -licm -adce -simplifycfg | dis | not grep 'br '
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int %main(int %argc) { int %main(int %argc) {
br label %bb5 br label %bb5

View File

@ -1,8 +1,5 @@
; Promoting some values allows promotion of other values. ; Promoting some values allows promotion of other values.
; RUN: if as < %s | opt -mem2reg | dis | grep alloca ; RUN: as < %s | opt -mem2reg | dis | not grep alloca
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int %test2() { int %test2() {
%result = alloca int ; ty=int* %result = alloca int ; ty=int*

View File

@ -2,10 +2,7 @@
; generated code should perform the appropriate masking operations required ; generated code should perform the appropriate masking operations required
; depending on the endianness of the target... ; depending on the endianness of the target...
; RUN: if as < %s | opt -mem2reg | dis | grep 'alloca' ; RUN: as < %s | opt -mem2reg | dis | not grep 'alloca'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation implementation

View File

@ -1,8 +1,5 @@
; Simple sanity check testcase. Both alloca's should be eliminated. ; Simple sanity check testcase. Both alloca's should be eliminated.
; RUN: if as < %s | opt -mem2reg | dis | grep 'alloca' ; RUN: as < %s | opt -mem2reg | dis | not grep 'alloca'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
implementation implementation

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -pinodes -instcombine -die | dis | grep add ; RUN: as < %s | opt -pinodes -instcombine -die | dis | not grep add
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %i, int %j) { int "test"(int %i, int %j) {
%c = seteq int %i, 0 %c = seteq int %i, 0

View File

@ -1,9 +1,6 @@
; RUN: if as < %s | opt -reassociate -instcombine -constprop -dce | dis | grep add ; RUN: as < %s | opt -reassociate -instcombine -constprop -dce | dis | not grep add
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %A) { int %test(int %A) {
%X = add int %A, 1 %X = add int %A, 1
%Y = add int %A, 1 %Y = add int %A, 1
%r = sub int %X, %Y %r = sub int %X, %Y

View File

@ -1,9 +1,6 @@
; RUN: if as < %s | opt -reassociate -instcombine -constprop -die | dis | grep 5 ; RUN: as < %s | opt -reassociate -instcombine -constprop -die | dis | not grep 5
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %A, int %B) { int %test(int %A, int %B) {
%W = add int %B, -5 %W = add int %B, -5
%Y = add int %A, 5 %Y = add int %A, 5
%Z = add int %W, %Y %Z = add int %W, %Y

View File

@ -1,11 +1,8 @@
; With sub reassociation, constant folding can eliminate all of the constants. ; With sub reassociation, constant folding can eliminate all of the constants.
; ;
; RUN: if as < %s | opt -reassociate -constprop -instcombine -dce | dis | grep add ; RUN: as < %s | opt -reassociate -constprop -instcombine -dce | dis | not grep add
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %A, int %B) { int %test(int %A, int %B) {
%W = add int 5, %B %W = add int 5, %B
%X = add int -7, %A %X = add int -7, %A
%Y = sub int %X, %W %Y = sub int %X, %W

View File

@ -1,9 +1,6 @@
; With sub reassociation, constant folding can eliminate the two 12 constants. ; With sub reassociation, constant folding can eliminate the two 12 constants.
; ;
; RUN: if as < %s | opt -reassociate -constprop -dce | dis | grep 12 ; RUN: as < %s | opt -reassociate -constprop -dce | dis | not grep 12
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %A, int %B, int %C, int %D) { int "test"(int %A, int %B, int %C, int %D) {
%M = add int %A, 12 %M = add int %A, 12

View File

@ -1,11 +1,8 @@
; With reassociation, constant folding can eliminate the 12 and -12 constants. ; With reassociation, constant folding can eliminate the 12 and -12 constants.
; ;
; RUN: if as < %s | opt -reassociate -constprop -instcombine -die | dis | grep add ; RUN: as < %s | opt -reassociate -constprop -instcombine -die | dis | not grep add
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %arg) { int %test(int %arg) {
%tmp1 = sub int -12, %arg %tmp1 = sub int -12, %arg
%tmp2 = add int %tmp1, 12 %tmp2 = add int %tmp1, 12
ret int %tmp2 ret int %tmp2

View File

@ -1,9 +1,6 @@
; With reassociation, constant folding can eliminate the +/- 30 constants. ; With reassociation, constant folding can eliminate the +/- 30 constants.
; ;
; RUN: if as < %s | opt -reassociate -constprop -instcombine -die | dis | grep 30 ; RUN: as < %s | opt -reassociate -constprop -instcombine -die | dis | not grep 30
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %reg109, int %reg1111) { int "test"(int %reg109, int %reg1111) {
%reg115 = add int %reg109, -30 ; <int> [#uses=1] %reg115 = add int %reg109, -30 ; <int> [#uses=1]

View File

@ -12,10 +12,7 @@
; In this case, we want to reassociate the specified expr so that i+j can be ; In this case, we want to reassociate the specified expr so that i+j can be
; hoisted out of the inner most loop. ; hoisted out of the inner most loop.
; ;
; RUN: if as < %s | opt -reassociate | dis | grep 115 | grep 117 ; RUN: as < %s | opt -reassociate | dis | grep 115 | not grep 117
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%.LC0 = internal global [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1] %.LC0 = internal global [4 x sbyte] c"%d\0A\00" ; <[4 x sbyte]*> [#uses=1]

View File

@ -1,9 +1,6 @@
; Reassociation should apply to Add, Mul, And, Or, & Xor ; Reassociation should apply to Add, Mul, And, Or, & Xor
; ;
; RUN: if as < %s | opt -reassociate -constprop -instcombine -die | dis | grep 12 ; RUN: as < %s | opt -reassociate -constprop -instcombine -die | dis | not grep 12
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test_mul"(int %arg) { int "test_mul"(int %arg) {
%tmp1 = mul int 12, %arg %tmp1 = mul int 12, %arg

View File

@ -1,9 +1,6 @@
; With sub reassociation, constant folding can eliminate the 12 and -12 constants. ; With sub reassociation, constant folding can eliminate the 12 and -12 constants.
; ;
; RUN: if as < %s | opt -reassociate -constprop -instcombine -die | dis | grep 12 ; RUN: as < %s | opt -reassociate -constprop -instcombine -die | dis | not grep 12
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(int %A, int %B) { int "test"(int %A, int %B) {
%X = add int -12, %A %X = add int -12, %A

View File

@ -5,13 +5,9 @@
; real benchmark (mst from Olden benchmark, MakeGraph function). When SCCP is ; real benchmark (mst from Olden benchmark, MakeGraph function). When SCCP is
; fixed, this should be eliminated by a single SCCP application. ; fixed, this should be eliminated by a single SCCP application.
; ;
; RUN: if as < %s | opt -sccp | dis | grep loop ; RUN: as < %s | opt -sccp | dis | not grep loop
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int *"test"() int* %test() {
begin
bb1: bb1:
%A = malloc int %A = malloc int
br label %bb2 br label %bb2
@ -24,5 +20,4 @@ bb2:
bb3: bb3:
ret int * %A ret int * %A
end }

View File

@ -1,12 +1,7 @@
; RUN: if as < %s | opt -sccp | dis | grep sub ; RUN: as < %s | opt -sccp | dis | not grep sub
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
void "test3"(int, int) void %test3(int, int) {
begin
add int 0, 0 add int 0, 0
sub int 0, 4 sub int 0, 4
ret void ret void
end }

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -sccp | dis | grep '%X' ; RUN: as < %s | opt -sccp | dis | not grep '%X'
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
%G = uninitialized global [40x int] %G = uninitialized global [40x int]

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -sccp -simplifycfg | dis | grep then: ; RUN: as < %s | opt -sccp -simplifycfg | dis | not grep then:
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
void %cprop_test11(int* %data.1) { void %cprop_test11(int* %data.1) {
entry: ; No predecessors! entry: ; No predecessors!

View File

@ -1,13 +1,9 @@
; This is a basic sanity check for constant propogation. The add instruction ; This is a basic sanity check for constant propogation. The add instruction
; should be eliminated. ; should be eliminated.
; RUN: if as < %s | opt -sccp | dis | grep add ; RUN: as < %s | opt -sccp | dis | not grep add
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test"(bool %B) int %test(bool %B) {
begin
br bool %B, label %BB1, label %BB2 br bool %B, label %BB1, label %BB2
BB1: BB1:
%Val = add int 0, 0 %Val = add int 0, 0
@ -17,4 +13,4 @@ BB2:
BB3: BB3:
%Ret = phi int [%Val, %BB1], [1, %BB2] %Ret = phi int [%Val, %BB1], [1, %BB2]
ret int %Ret ret int %Ret
end }

View File

@ -1,13 +1,9 @@
; This is the test case taken from appel's book that illustrates a hard case ; This is the test case taken from appel's book that illustrates a hard case
; that SCCP gets right. BB3 should be completely eliminated. ; that SCCP gets right. BB3 should be completely eliminated.
; ;
; RUN: if as < %s | opt -sccp -constprop -dce -cfgsimplify | dis | grep BB3 ; RUN: as < %s | opt -sccp -constprop -dce -cfgsimplify | dis | not grep BB3
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int "test function"(int %i0, int %j0) int %test function(int %i0, int %j0) {
begin
BB1: BB1:
br label %BB2 br label %BB2
BB2: BB2:
@ -35,5 +31,4 @@ BB7:
%j4 = phi int [1, %BB5], [%k2, %BB6] %j4 = phi int [1, %BB5], [%k2, %BB6]
%k4 = phi int [%k3, %BB5], [%k5, %BB6] %k4 = phi int [%k3, %BB5], [%k5, %BB6]
br label %BB2 br label %BB2
end }

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -scalarrepl -mem2reg | dis | grep alloca ; RUN: as < %s | opt -scalarrepl -mem2reg | dis | not grep alloca
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int %test() { int %test() {
%X = alloca [ 4 x int ] %X = alloca [ 4 x int ]

View File

@ -1,7 +1,4 @@
; RUN: if as < %s | opt -scalarrepl -mem2reg | dis | grep alloca ; RUN: as < %s | opt -scalarrepl -mem2reg | dis | not grep alloca
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
int %test() { int %test() {
%X = alloca { int, float } %X = alloca { int, float }