llvm-6502/test/Transforms/CorrelatedExprs/whet.ll
Reid Spencer 08af6fd5fc For PR1319:
Convert to use the new Tcl expr based test harness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36061 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-15 08:01:33 +00:00

47 lines
1.2 KiB
LLVM

; 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
}