New testcase distilled from SPEC MCF benchmark
[oota-llvm.git] / test / Transforms / LevelRaise / 2002-03-14-ConvertableToGEPHang.ll
1 ; This testcase found a bug in ConvertableToGEP that could cause an infinite loop
2 ; Note that this code is actually miscompiled from the input source, but despite 
3 ; that, level raise should not hang!
4 ;
5 ; RUN: as < %s | opt -raise     
6         
7         %Disjunct = type { \2 *, short, sbyte, sbyte *, { short, short, sbyte, sbyte, \2, sbyte * } *, { short, short, sbyte, sbyte, \2, sbyte * } * }
8 %chosen_disjuncts = uninitialized global %Disjunct * *          ; <%Disjunct * * *> [#uses=1]
9 implementation
10
11 void "build_image_array"()
12 begin
13 bb0:                                    ;[#uses=0]
14         %reg109 = getelementptr %Disjunct * * * %chosen_disjuncts, uint 7               ; <%Disjunct * * *> [#uses=1]
15         %reg108 = load %Disjunct * * * %reg109          ; <%Disjunct * *> [#uses=1]
16         %reg1000 = getelementptr %Disjunct * * %reg108, uint 3          ; <%Disjunct * *> [#uses=1]
17         %cast1007 = cast %Disjunct * * %reg1000 to sbyte * *            ; <sbyte * *> [#uses=1]
18         %reg110 = load sbyte * * %cast1007              ; <sbyte *> [#uses=1]
19         %cast1008 = cast ulong 4 to sbyte *             ; <sbyte *> [#uses=1]
20         %A = cast sbyte * %reg110 to ulong
21         %B = cast sbyte * %cast1008 to ulong
22         %reg1001 = add ulong %A, %B             ; <sbyte *> [#uses=0]
23         ret void
24 end