New testcase distilled from SPEC MCF benchmark
[oota-llvm.git] / test / Transforms / LevelRaise / 2002-04-09-MissedRaise.ll
1 ; This example was not getting level raised because of a negative index from
2 ; this instruction:
3 ;   %reg111 = add int %reg110, -12
4 ; this testcase is distilled from this C source:
5 ; void foo(int j, int *x) {
6 ;   unsigned i;
7 ;   for (i = 12; i < 14; ++i) 
8 ;     x[j*i-12] = j;
9 ; }
10
11 ; RUN: if as < %s | opt -raise | dis | grep ' cast ' | grep '*'
12 ; RUN: then exit 1
13 ; RUN: else exit 0
14 ; RUN: fi
15
16 implementation
17
18 void "foo"(int %j, int * %x)
19 begin
20 bb0:                                    ;[#uses=0]
21         br label %bb1
22
23 bb1:                                    ;[#uses=2]
24         %reg108 = cast int * %x to sbyte *              ; <sbyte *> [#uses=1]
25         %cond219 = setgt ulong 12, 13           ; <bool> [#uses=1]
26         br bool %cond219, label %bb3, label %bb2
27
28 bb2:                                    ;[#uses=3]
29         %cann-indvar = phi uint [ 0, %bb1 ], [ %add1-indvar, %bb2 ]             ; <uint> [#uses=2]
30         %reg117 = add uint %cann-indvar, 12             ; <uint> [#uses=2]
31         %add1-indvar = add uint %cann-indvar, 1         ; <uint> [#uses=1]
32         %cast224 = cast uint %reg117 to uint            ; <uint> [#uses=1]
33         %cast225 = cast uint %reg117 to int             ; <int> [#uses=1]
34         %reg110 = mul int %j, %cast225          ; <int> [#uses=1]
35         %reg111 = add int %reg110, -12          ; <int> [#uses=1]
36         %cast222 = cast int %reg111 to uint             ; <uint> [#uses=1]
37         %reg113 = shl uint %cast222, ubyte 2            ; <uint> [#uses=1]
38         %cast114 = cast uint %reg113 to ulong           ; <ulong> [#uses=1]
39         %cast115 = cast ulong %cast114 to sbyte *               ; <sbyte *> [#uses=1]
40         %reg116 = add sbyte * %reg108, %cast115         ; <sbyte *> [#uses=1]
41         %cast223 = cast sbyte * %reg116 to int *                ; <int *> [#uses=1]
42         store int %j, int * %cast223
43         %reg118 = add uint %cast224, 1          ; <uint> [#uses=1]
44         %cond220 = setle uint %reg118, 13               ; <bool> [#uses=1]
45         br bool %cond220, label %bb2, label %bb3
46
47 bb3:                                    ;[#uses=2]
48         ret void
49 end