2003-09-16 15:29:54 +00:00
|
|
|
; RUN: llvm-as < %s | opt -cee
|
2002-10-07 20:25:45 +00:00
|
|
|
;
|
|
|
|
; The 'cee' pass is breaking SSA form when it blindly forwards the branch from
|
|
|
|
; Eq to branch to "Forwarded" instead.
|
2002-10-07 20:05:27 +00:00
|
|
|
|
|
|
|
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:
|
2002-10-08 19:11:02 +00:00
|
|
|
%Z2 = phi int [%Z, %Loop]
|
|
|
|
call int %test(int 0, int %Z2, bool true)
|
2002-10-07 20:05:27 +00:00
|
|
|
br label %Bottom
|
|
|
|
|
|
|
|
Bottom:
|
|
|
|
br label %Loop
|
|
|
|
}
|