New testcase distilled from SPEC MCF benchmark
[oota-llvm.git] / test / Transforms / LevelRaise / 2002-03-20-BadCodegen.ll
1 ; This testcase tests whether the raise pass generates bad code for a 
2 ; getelementptr instruction... with a bad level raise pass, this code
3 ; will segfault on execution.
4 ;
5 ; RUN: as < %s | opt -raise  |lli -abort-on-exception  
6  
7  %Village = type { [4 x \3 *], \2 *, { \2 *, { int, int, int, \5 * } *, \2 * }, { int, int, int, { \2 *, { int, int, int, \6 * } *, \2 * }, { \2 *, { int, int,
8   int, \6 * } *, \2 * }, { \2 *, { int, int, int, \6 * } *, \2 * }, { \2 *, { int, int, int, \6 * } *, \2 * } }, int, int }
9
10
11
12 implementation
13
14 void "foo"(%Village *%V)
15 begin
16         ret void
17 end
18
19 void "main"(int %argc, sbyte **%argv)
20 begin
21 ; <label>:0         ;[#uses=0]
22   %fval = alloca %Village *, uint 4   ; <%Village * *> [#uses=1]
23   %reg115 = malloc sbyte, uint 184    ; <sbyte *> [#uses=2]
24   br label %bb4
25
26 bb4:          ;[#uses=2]
27   %reg130 = shl int %argc, ubyte 2   ; <int> [#uses=1]
28   %reg131 = add int %reg130, 3    ; <int> [#uses=1]
29   %reg132 = add int %reg131, 1    ; <int> [#uses=1]
30   %cast323 = cast sbyte * %reg115 to %Village *   ; <%Village *> [#uses=1]
31   call void %foo(%Village * %cast323)    ; <%Village *> [#uses=0]
32   br label %bb6
33
34 bb6:          ;[#uses=3]
35   %reg176 = phi int [ %reg177, %bb6 ], [ 0, %bb4 ]    ; <int> [#uses=2]
36   %cast370 = cast int %reg176 to int    ; <int> [#uses=1]
37   %cast366 = cast int %reg176 to uint   ; <uint> [#uses=1]
38   %reg159 = shl uint %cast366, ubyte 3    ; <uint> [#uses=1]
39   %cast161 = cast uint %reg159 to ulong   ; <ulong> [#uses=1]
40   %cast160 = cast ulong %cast161 to sbyte *   ; <sbyte *> [#uses=2]
41   %reg162 = add sbyte * %reg115, %cast160   ; <sbyte *> [#uses=0]
42   %cast367 = cast %Village * * %fval to sbyte *   ; <sbyte *> [#uses=1]
43   %reg169 = add sbyte * %cast367, %cast160    ; <sbyte *> [#uses=1]
44   %cast368 = cast sbyte * %reg169 to sbyte * *    ; <sbyte * *> [#uses=1]
45   %reg170 = load sbyte * * %cast368   ; <sbyte *> [#uses=1]
46   %V = cast sbyte *%reg170 to %Village*
47   call void %foo(%Village *%V)
48   %reg177 = add int %cast370, 1   ; <int> [#uses=2]
49   %cond303 = setle int %reg177, 3   ; <bool> [#uses=1]
50   br bool %cond303, label %bb6, label %bb7
51
52 bb7:          ;[#uses=1]
53   ret void
54 end