New testcase distilled from SPEC MCF benchmark
[oota-llvm.git] / test / Transforms / LevelRaise / 2002-04-16-MissedRaise.ll
1 ; this testcase is distilled from this C source:
2 ; int *foo(unsigned N, unsigned M) {
3 ;   unsigned i = (N+1)*sizeof(int);
4 ;   unsigned j = (M+1)*sizeof(int);
5 ;   return (int*)malloc(i+j);
6 ; }
7
8 ; RUN: if as < %s | opt -raise | dis | grep ' cast ' | grep '*'
9 ; RUN: then exit 1
10 ; RUN: else exit 0
11 ; RUN: fi
12
13 implementation
14
15 declare sbyte* "malloc"(uint)
16
17 int* "test"(uint %N, uint %M)
18 begin
19 bb0:                                    ;[#uses=0]
20         %reg111 = shl uint %N, ubyte 2          ; <uint> [#uses=1]
21         %reg109 = add uint %reg111, 4           ; <uint> [#uses=1]
22         %reg114 = shl uint %M, ubyte 2          ; <uint> [#uses=1]
23         %reg112 = add uint %reg114, 4           ; <uint> [#uses=1]
24         %reg116 = add uint %reg109, %reg112             ; <uint> [#uses=1]
25         %reg117 = malloc sbyte, uint %reg116            ; <sbyte*> [#uses=1]
26         %cast221 = cast sbyte* %reg117 to int*          ; <int*> [#uses=1]
27         ret int* %cast221
28 end