llvm-6502/test/Transforms/LevelRaise/2002-03-20-BadCodegen.ll
Chris Lattner f7f04098ce New testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1920 91177308-0d34-0410-b5e6-96231b3b80d8
2002-03-21 03:01:14 +00:00

55 lines
2.1 KiB
LLVM

; 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: as < %s | opt -raise |lli -abort-on-exception
%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
void "main"(int %argc, sbyte **%argv)
begin
; <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]
%cast160 = cast ulong %cast161 to sbyte * ; <sbyte *> [#uses=2]
%reg162 = add sbyte * %reg115, %cast160 ; <sbyte *> [#uses=0]
%cast367 = cast %Village * * %fval to sbyte * ; <sbyte *> [#uses=1]
%reg169 = add sbyte * %cast367, %cast160 ; <sbyte *> [#uses=1]
%cast368 = cast sbyte * %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 void
end