summaryrefslogtreecommitdiff
path: root/test/Transforms/LevelRaise/2002-03-20-BadCodegen.ll
blob: a6d33eeff3c5bd4446eff9fd9ea2b8ba03139bdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
; This testcase tests whether the raise pass generates bad code for a 
; getelementptr instruction... with a bad level raise pass, this code
; will segfault on execution.
;
; RUN: llvm-as < %s | opt -raise  |lli 
 
 %Village = type { [4 x \3 *], \2 *, { \2 *, { int, int, int, \5 * } *, \2 * }, { int, int, int, { \2 *, { int, int, int, \6 * } *, \2 * }, { \2 *, { int, int,
  int, \6 * } *, \2 * }, { \2 *, { int, int, int, \6 * } *, \2 * }, { \2 *, { int, int, int, \6 * } *, \2 * } }, int, int }



implementation

void "foo"(%Village *%V)
begin
	ret void
end

int %main(int %argc, sbyte **%argv) {
; <label>:0         ;[#uses=0]
  %fval = alloca %Village *, uint 4   ; <%Village * *> [#uses=1]
  %reg115 = malloc sbyte, uint 184    ; <sbyte *> [#uses=2]
  br label %bb4

bb4:          ;[#uses=2]
  %reg130 = shl int %argc, ubyte 2   ; <int> [#uses=1]
  %reg131 = add int %reg130, 3    ; <int> [#uses=1]
  %reg132 = add int %reg131, 1    ; <int> [#uses=1]
  %cast323 = cast sbyte * %reg115 to %Village *   ; <%Village *> [#uses=1]
  call void %foo(%Village * %cast323)    ; <%Village *> [#uses=0]
  br label %bb6

bb6:          ;[#uses=3]
  %reg176 = phi int [ %reg177, %bb6 ], [ 0, %bb4 ]    ; <int> [#uses=2]
  %cast370 = cast int %reg176 to int    ; <int> [#uses=1]
  %cast366 = cast int %reg176 to uint   ; <uint> [#uses=1]
  %reg159 = shl uint %cast366, ubyte 3    ; <uint> [#uses=1]
  %cast161 = cast uint %reg159 to ulong   ; <ulong> [#uses=1]
  %cast367 = cast %Village * * %fval to ulong   ; <sbyte *> [#uses=1]
  %reg169 = add ulong %cast367, %cast161
  %cast368 = cast ulong %reg169 to sbyte * *    ; <sbyte * *> [#uses=1]
  %reg170 = load sbyte * * %cast368   ; <sbyte *> [#uses=1]
  %V = cast sbyte *%reg170 to %Village*
  call void %foo(%Village *%V)
  %reg177 = add int %cast370, 1   ; <int> [#uses=2]
  %cond303 = setle int %reg177, 3   ; <bool> [#uses=1]
  br bool %cond303, label %bb6, label %bb7

bb7:          ;[#uses=1]
  ret int 0
}