44c72587b25118f9732a4d418a7783bab4219093
[oota-llvm.git] / test / LLC / fwdtwice.ll
1 ;;
2 ;; Test the sequence:
3 ;;      cast -> setle 0, %cast -> br %cond
4 ;; This sequence should cause the cast value to be forwarded twice,
5 ;; i.e., cast is forwarded to the setle and teh setle is forwarded
6 ;; to the branch.
7 ;; register argument of the "branch-on-register" instruction, i.e.,
8 ;; 
9 ;; This produces the bogus output instruction:
10 ;;      brlez   <NULL VALUE>, .L_SumArray_bb3.
11 ;; This came from %bb1 of sumarrray.ll generated from sumarray.c.
12
13
14 ;;;; ******************************************************
15 implementation
16 ;;;; ******************************************************
17
18 int "SumArray"(int %Num)
19 begin
20 bb0:                                    ;[#uses=3]
21         br label %Top
22 Top:
23         %Num = alloca int               ; <int *> [#uses=2]
24         store int %Num, int * %Num
25         %reg108 = load int * %Num               ; <int> [#uses=2]
26         %cast1006 = cast int %reg108 to uint            ; <uint> [#uses=1]
27         %cond1001 = setle uint %cast1006, 0             ; <bool> [#uses=1]
28         br bool %cond1001, label %bb6, label %Top
29
30 bb6:
31         ret int 42
32 end
33