1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

The CorrelatedExpressions pass is now no more.

llvm-svn: 46409
This commit is contained in:
Bill Wendling 2008-01-27 06:13:32 +00:00
parent 629a569ce9
commit 0e2b8c2c45
12 changed files with 0 additions and 462 deletions

View File

@ -1,29 +0,0 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -cee
implementation
declare void %foo(int)
void %test(int %A, bool %C) {
br bool %C, label %bb0, label %bb1
bb0:
br label %bb3
Unreachable:
br label %bb2
bb1: ;[#uses=0]
%cond212 = setgt int %A, 9 ; <bool> [#uses=1]
br bool %cond212, label %bb2, label %bb7
bb2: ;[#uses=1]
%cond = setgt int %A, 7
br bool %cond, label %bb3, label %bb7
bb3: ;[#uses=1]
%X = phi int [ 0, %bb0], [ 12, %bb2]
call void %foo( int %X )
br label %bb7
bb7: ;[#uses=2]
ret void
}

View File

@ -1,45 +0,0 @@
; This test checks to see if the CEE pass is applying jump-bypassing for values
; determined by PHI nodes. Because we are coming from a particular block, we
; know what value a PHI node will take on this edge and should exploit it.
;
; This testcase comes from the following C code:
; void bar(void);
; void foo(int c) {
; int i = c ? 2 : 8;
; while (i < 20) {
; bar ();
; i++;
; }
; }
;
; RUN: llvm-upgrade < %s | llvm-as | opt -cee -simplifycfg | llvm-dis | not grep bb3
implementation
declare void %bar()
void %foo(int %c) {
bb0: ; No predecessors!
%cond215 = seteq int %c, 0 ; <bool> [#uses=1]
br bool %cond215, label %bb3, label %bb4
bb3: ; preds = %bb0
br label %bb4
bb4: ; preds = %bb3, %bb0
%reg110 = phi int [ 8, %bb3 ], [ 2, %bb0 ] ; <int> [#uses=2]
%cond217 = setgt int %reg110, 19 ; <bool> [#uses=1]
br bool %cond217, label %bb6, label %bb5
bb5: ; preds = %bb5, %bb4
%cann-indvar = phi int [ 0, %bb4 ], [ %add1-indvar, %bb5 ] ; <int> [#uses=2]
%add1-indvar = add int %cann-indvar, 1 ; <int> [#uses=1]
%reg111 = add int %cann-indvar, %reg110 ; <int> [#uses=1]
call void %bar( )
%reg112 = add int %reg111, 1 ; <int> [#uses=1]
%cond222 = setle int %reg112, 19 ; <bool> [#uses=1]
br bool %cond222, label %bb5, label %bb6
bb6: ; preds = %bb5, %bb4
ret void
}

View File

@ -1,35 +0,0 @@
; Testcase distilled from bisort where we tried to perform branch target
; forwarding where it was not safe.
; RUN: llvm-upgrade < %s | llvm-as | opt -cee
;
%HANDLE = type { int, %HANDLE*, %HANDLE* }
%struct.node = type { int, %HANDLE*, %HANDLE* }
%.LC0 = internal global [11 x sbyte] c"%d @ 0x%x\0A\00" ; <[11 x sbyte]*> [#uses=1]
implementation ; Functions:
void %InOrder(%HANDLE* %h) {
bb0: ; No predecessors!
br label %bb2
bb2: ; preds = %bb3, %bb0
%reg113 = phi %HANDLE* [ %reg109, %bb3 ], [ %h, %bb0 ] ; <%HANDLE*> [#uses=4]
%cond217 = seteq %HANDLE* %reg113, null ; <bool> [#uses=1]
br bool %cond217, label %bb4, label %bb3
bb3: ; preds = %bb2
%reg221 = getelementptr %HANDLE* %reg113, long 0, uint 1 ; <%HANDLE**> [#uses=1]
%reg108 = load %HANDLE** %reg221 ; <%HANDLE*> [#uses=1]
%reg226 = getelementptr %HANDLE* %reg113, long 0, uint 2 ; <%HANDLE**> [#uses=1]
%reg109 = load %HANDLE** %reg226 ; <%HANDLE*> [#uses=1]
call void %InOrder( %HANDLE* %reg108 )
%cast231 = getelementptr %HANDLE* %reg113, long 0, uint 0 ; <int*> [#uses=1]
%reg111 = load int* %cast231 ; <int> [#uses=1]
%reg233 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([11 x sbyte]* %.LC0, long 0, long 0), int %reg111, uint 0 ) ; <int> [#uses=0]
br label %bb2
bb4: ; preds = %bb2
ret void
}
declare int %printf(sbyte*, ...)

View File

@ -1,28 +0,0 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -cee
;
; The 'cee' pass is breaking SSA form when it blindly forwards the branch from
; Eq to branch to "Forwarded" instead.
implementation
int %test(int %A, int %B, bool %c0) {
Start:
%c1 = seteq int %A, %B
br bool %c1, label %Eq, label %Loop
Eq: ; In this block we know that A == B
br label %Loop ; This should be modified to branch to "Forwarded".
Loop: ;; Merge point, nothing is known here...
%Z = phi int [%A, %Start], [%B, %Eq], [%Z, %Bottom]
%c2 = setgt int %A, %B
br bool %c2, label %Forwarded, label %Bottom
Forwarded:
%Z2 = phi int [%Z, %Loop]
call int %test(int 0, int %Z2, bool true)
br label %Bottom
Bottom:
br label %Loop
}

View File

@ -1,17 +0,0 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -cee
;
; This testcase causes an assertion error.
;
implementation ; Functions:
void %test(int %A) {
br label %bb2
bb2:
ret void
bb3: ; No predecessors!
br bool true, label %bb4, label %bb2
bb4:
ret void
}

View File

@ -1,32 +0,0 @@
; Test to make sure that SSA is correctly updated
; RUN: llvm-upgrade < %s | llvm-as | opt -cee
;
implementation ; Functions:
int %test(int %A, int %B, bool %c0) {
Start: ; No predecessors!
%c1 = seteq int %A, %B ; <bool> [#uses=1]
br bool %c1, label %Eq, label %Start_crit_edge
Start_crit_edge: ; preds = %Start
br label %Loop
Eq: ; preds = %Start
br label %Loop
Loop: ; preds = %Bottom, %Eq, %Start_crit_edge
%Z = phi int [ %A, %Start_crit_edge ], [ %B, %Eq ], [ %Z, %Bottom ] ; <int> [#uses=2]
%c2 = setge int %A, %B ; <bool> [#uses=1]
br bool %c2, label %Forwarded, label %Loop_crit_edge
Loop_crit_edge: ; preds = %Loop
br label %Bottom
Forwarded: ; preds = %Loop
%Z2 = phi int [ %Z, %Loop ] ; <int> [#uses=1]
call int %test( int 0, int %Z2, bool true ) ; <int>:0 [#uses=0]
br label %Bottom
Bottom: ; preds = %Forwarded, %Loop_crit_edge
br label %Loop
}

View File

@ -1,34 +0,0 @@
; Simple test to make sure dominators are updated properly
; RUN: llvm-upgrade < %s | llvm-as | opt -cee
implementation ; Functions:
int %test(int %A, int %B, bool %c0) {
Start: ; No predecessors!
%c1 = seteq int %A, %B ; <bool> [#uses=1]
br bool %c1, label %Eq, label %Start_crit_edge
Start_crit_edge: ; preds = %Start
br label %Loop
Eq: ; preds = %Start
br label %Loop
Loop: ; preds = %Bottom, %Eq, %Start_crit_edge
%Z = phi int [ %A, %Start_crit_edge ], [ %B, %Eq ];, [ %Z, %Bottom ] ; <int> [#uses=2]
%c2 = setge int %A, %B ; <bool> [#uses=1]
br bool %c2, label %Forwarded, label %Loop_crit_edge
Loop_crit_edge: ; preds = %Loop
%X = seteq int %Z, 7
br bool %X, label %Forwarded, label %Bottom
Forwarded: ; preds = %Loop
%Z2 = phi int [ %Z, %Loop ], [%Z, %Loop_crit_edge] ; <int> [#uses=1]
call int %test( int %Z, int %Z2, bool true ) ; <int>:0 [#uses=0]
br label %Bottom
Bottom: ; preds = %Forwarded, %Loop_crit_edge
ret int %Z
;br label %Loop
}

View File

@ -1,136 +0,0 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -cee -constprop -instcombine -dce | \
; RUN: llvm-dis | not grep REMOVE
int %test1(int %A) {
%cond = seteq int %A, 40
br bool %cond, label %T, label %F
T:
%REMOVE = add int %A, 2 ; Should become = 42
ret int %REMOVE
F:
ret int 8
}
bool %test2(int %A) {
%cond = seteq int %A, 40
br bool %cond, label %T, label %F
T:
%REMOVE = seteq int %A, 2 ; Should become = false
ret bool %REMOVE
F:
ret bool false
}
bool %test3(int %A) {
%cond = setlt int %A, 40
br bool %cond, label %T, label %F
T:
%REMOVE = setgt int %A, 47 ; Should become = false
ret bool %REMOVE
F:
%REMOVE2 = setge int %A, 40 ; Should become = true
ret bool %REMOVE2
}
bool %test4(int %A) {
%cond = setlt int %A, 40
br bool %cond, label %T, label %F
T:
%REMOVE = setgt int %A, 47 ; Should become = false
ret bool %REMOVE
F:
ret bool false
}
int %test5(int %A, int %B) {
%cond = setne int %A, %B
br bool %cond, label %F, label %T
T:
%C = sub int %A, %B ; = 0
ret int %C
F:
ret int 0
}
bool %test6(int %A) {
%REMOVE = setlt int %A, 47 ; Should become dead
%cond = setlt int %A, 40
br bool %cond, label %T, label %F
T:
ret bool %REMOVE ;; == true
F:
ret bool false
}
bool %test7(int %A) {
%cond = setlt int %A, 40
br bool %cond, label %T, label %F
T:
%REMOVE = xor bool %cond, true
ret bool %REMOVE
F:
ret bool false
}
; Test that and expressions are handled...
bool %test8(int %A, int %B) {
%cond1 = setle int %A, 7
%cond2 = setle int %B, 7
%cond = and bool %cond1, %cond2
br bool %cond, label %T, label %F
T:
%REMOVE1 = seteq int %A, 9 ; false
%REMOVE2 = setge int %B, 9 ; false
%REMOVE = or bool %REMOVE1, %REMOVE2 ; false
ret bool %REMOVE
F:
ret bool false
}
; Test that or expressions are handled...
bool %test9(int %A, int %B) {
%cond1 = setle int %A, 7
%cond2 = setle int %B, 7
%cond = or bool %cond1, %cond2
br bool %cond, label %T, label %F
T:
ret bool false
F:
%REMOVE1 = setge int %A, 8 ; true
%REMOVE2 = setge int %B, 8 ; true
%REMOVE = or bool %REMOVE1, %REMOVE2 ; true
ret bool %REMOVE
}
bool %test10(int %A) {
%cond = setle int %A, 7
br bool %cond, label %T, label %F
T:
ret bool false
F:
%REMOVE = setge int %A, 8
ret bool %REMOVE
}
; Implement correlated comparisons against non-constants
bool %test11(int %A, int %B) {
%cond = setlt int %A, %B
br bool %cond, label %T, label %F
T:
%REMOVE1 = seteq int %A, %B ; false
%REMOVE2 = setle int %A, %B ; true
%cond2 = and bool %REMOVE1, %REMOVE2
ret bool %cond2
F:
ret bool true
}
bool %test12(int %A) {
%cond = setlt int %A, 0
br bool %cond, label %T, label %F
T:
%REMOVE = setne int %A, 0 ; true
ret bool %REMOVE
F:
ret bool false
}

View File

@ -1,35 +0,0 @@
; RUN: echo %s
implementation
declare void %foo(int)
void %test(int %A) {
bb1: ;[#uses=0]
%cond212 = setgt int %A, 9 ; <bool> [#uses=1]
br bool %cond212, label %REMOVEbb3, label %bb2
bb2: ;[#uses=1]
call void %foo( int 123 )
br label %REMOVEbb3
REMOVEbb3: ;[#uses=2]
%cond217 = setle int %A, 9 ; <bool> [#uses=1]
br bool %cond217, label %REMOVEbb5, label %bb4
bb4: ;[#uses=1]
call void %foo( int 234 )
br label %REMOVEbb5
REMOVEbb5: ;[#uses=2]
%cond222 = setgt int %A, 9 ; <bool> [#uses=1]
br bool %cond222, label %bb7, label %REMOVEbb6
REMOVEbb6: ;[#uses=1]
call void %foo( int 456 )
br label %bb7
bb7: ;[#uses=2]
ret void
}

View File

@ -1,3 +0,0 @@
load_lib llvm.exp
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]

View File

@ -1,22 +0,0 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -cee -constprop -instcombine -dce | \
; RUN: llvm-dis | not grep REMOVE
; END.
int %test_case_values_should_propagate(int %A) {
switch int %A, label %D [
int 40, label %C1
int 41, label %C2
int 42, label %C3
]
C1:
%REMOVE1 = add int %A, 2 ; Should be 42.
ret int %REMOVE1
C2:
%REMOVE2 = add int %A, 3 ; Should be 44.
ret int %REMOVE2
C3:
%REMOVE3 = add int %A, 4 ; Should be 46.
ret int %REMOVE3
D:
ret int 10
}

View File

@ -1,46 +0,0 @@
; This code snippet is derived from the following "whetstone" style code:
; int whet(int j) {
; if (j == 1) j = 2;
; else j = 7;
; if (j > 2) j = 0;
; else j = 3;
; if (j < 1) j = 10;
; else j = 0;
; return j;
;}
;
; This should eliminate all BB's except BB0, BB9, BB10
;
; RUN: llvm-upgrade < %s | llvm-as | opt -cee -instcombine -simplifycfg | \
; RUN: llvm-dis | not grep {bb\[2-8\]}
implementation ; Functions:
int %whet(int %j) {
bb0: ; No predecessors!
%cond220 = setne int %j, 1 ; <bool> [#uses=1]
br bool %cond220, label %bb3, label %bb4
bb3: ; preds = %bb0
br label %bb4
bb4: ; preds = %bb3, %bb0
%reg111 = phi int [ 7, %bb3 ], [ 2, %bb0 ] ; <int> [#uses=1]
%cond222 = setle int %reg111, 2 ; <bool> [#uses=1]
br bool %cond222, label %bb6, label %bb7
bb6: ; preds = %bb4
br label %bb7
bb7: ; preds = %bb6, %bb4
%reg114 = phi int [ 3, %bb6 ], [ 0, %bb4 ] ; <int> [#uses=1]
%cond225 = setgt int %reg114, 0 ; <bool> [#uses=1]
br bool %cond225, label %bb9, label %bb10
bb9: ; preds = %bb7
br label %bb10
bb10: ; preds = %bb9, %bb7
%reg117 = phi int [ 0, %bb9 ], [ 10, %bb7 ] ; <int> [#uses=1]
ret int %reg117
}