New testcase
authorChris Lattner <sabre@nondot.org>
Thu, 21 Mar 2002 03:01:14 +0000 (03:01 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 21 Mar 2002 03:01:14 +0000 (03:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1920 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/LevelRaise/2002-03-20-BadCodegen.ll [new file with mode: 0644]

diff --git a/test/Transforms/LevelRaise/2002-03-20-BadCodegen.ll b/test/Transforms/LevelRaise/2002-03-20-BadCodegen.ll
new file mode 100644 (file)
index 0000000..84f0505
--- /dev/null
@@ -0,0 +1,54 @@
+; 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