llvm-6502/test/Transforms/CorrelatedExprs/2002-10-03-PHIPropogate.ll
Chris Lattner 24b7799a10 New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4030 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-03 20:06:33 +00:00

49 lines
1.5 KiB
LLVM

; 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: if as < %s | opt -cee -simplifycfg | dis | grep bb3
; RUN: then exit 1
; RUN: else exit 0
; RUN: fi
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
}