Update LLVM tests to use new pointer indexing, and remove unsized array test support
authorChris Lattner <sabre@nondot.org>
Fri, 14 Dec 2001 16:46:53 +0000 (16:46 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Dec 2001 16:46:53 +0000 (16:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1474 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
test/Feature/allocatest2.ll
test/Feature/globalvars.ll
test/Feature/opaquetypes.ll
test/Feature/recursivetype.ll
test/Feature/testalloca.ll
test/Feature/testconstants.ll
test/Feature/testmemory.ll
test/Linker/testlink1.ll
test/Linker/testlink2.ll
test/ackermann.ll [deleted file]
test/fib.ll [deleted file]
test/fib2.ll [deleted file]

index 2775f0129e49973f8e17361e0926a36933885e13..7c93215a6e166832adf99762db879862d1bc317d 100644 (file)
@@ -8,8 +8,8 @@ void "_Z17UseAllocaFunctionj"(uint %n)
 begin
 bb1:            ;;<label>
         %reg110 = shl uint %n, ubyte 2          ;;<uint>
-        %reg108 = alloca [ubyte], uint %reg110            ;;<ubyte*>
-        %cast1000 = cast [ubyte]* %reg108 to uint*                ;;<uint*>
+        %reg108 = alloca ubyte, uint %reg110            ;;<ubyte*>
+        %cast1000 = cast ubyte* %reg108 to uint*                ;;<uint*>
         call void %_Z12combinationsjPj(uint %n, uint* %cast1000)                ;;<void>
         %cast113 = cast uint %reg110 to ulong*          ;;<ulong*>
        cast uint 7 to ulong *
@@ -17,8 +17,8 @@ bb1:            ;;<label>
         %reg115 = shr ulong* %reg114, ubyte 3           ;;<ulong*>:(uns ops)
         %reg117 = shl ulong* %reg115, ubyte 3           ;;<ulong*>
         %cast1001 = cast ulong* %reg117 to uint         ;;<uint>
-        %reg118 = alloca [ubyte], uint %cast1001          ;;<ubyte*>
-        %cast1002 = cast [ubyte]* %reg118 to uint*                ;;<uint*>
+        %reg118 = alloca ubyte, uint %cast1001          ;;<ubyte*>
+        %cast1002 = cast ubyte* %reg118 to uint*                ;;<uint*>
         call void %_Z12combinationsjPj(uint %n, uint* %cast1002)                ;;<void>
         ret void                ;;<void>
 end
index 3914efc3e4216368406ec805d75ec19643908190..b243ba58d8ca61e53c89247644ed8dc1929d1d96 100644 (file)
@@ -12,7 +12,7 @@ implementation
 int "foo"(int %blah)
 begin
        store int 5, int *%MyVar
-       store int 12, { \2 *, int } * %MyIntList, ubyte 1
+       store int 12, { \2 *, int } * %MyIntList, uint 0, ubyte 1
        ret int %blah
 end
 
index fcd0999d4a76acd9f7fe407ec6bbff617a192ce3..271493f222acacc7b2a579ddaf9b611a42e70ac1 100644 (file)
@@ -10,7 +10,7 @@
 
 %CCC = type { \2* }
 %BBB = type { \2*, \2 * }
-%AAA = type { \2*, {\2*}, [{\2*}], {[1x{\2*}]} }
+%AAA = type { \2*, {\2*}, [12x{\2*}], {[1x{\2*}]} }
 
 ; Test numbered types
 type %CCC
@@ -35,7 +35,7 @@ type %BBB
 
 ; A complex recursive type...
 %Y = type { {%Y*}, %Y* }
-%Z = type { { %Z * }, [%Z] *, {{{ %Z * }}} }
+%Z = type { { %Z * }, [12x%Z] *, {{{ %Z * }}} }
 
 ; More ridiculous test cases...
 %A = type [ 123x %A*]
@@ -49,7 +49,7 @@ type %BBB
 ; Test the parser for unnamed recursive types...
 %P1 = type \1 *
 %Y1 = type { { \3 * }, \2 * }
-%Z1 = type { { \3 * }, [\3] *, { { { \5 * } } } }
+%Z1 = type { { \3 * }, [12x\3] *, { { { \5 * } } } }
 
 implementation
 
index ce8214507c68f35ac48a1fdea8608bd9af122581..60ffc510d510ef87092e0aed81ec25a4921ed633 100644 (file)
@@ -85,11 +85,10 @@ bb2:
         br bool %cond1011, label %bb4, label %bb3
 
 bb3:
-        %cast1015 = cast ulong 0 to %list*                      ;;<%list*>
-        ret %list* %cast1015
+        ret %list* null
 
 bb4:
-        %reg111 = load %list* %reg115, ubyte 1                  ;;<int>
+        %reg111 = load %list* %reg115, uint 0, ubyte 1                  ;;<int>
         %cond1013 = setne int %reg111, %Data                    ;;<bool>
         br bool %cond1013, label %bb6, label %bb5
 
@@ -97,6 +96,6 @@ bb5:
         ret %list* %reg115
 
 bb6:
-        %reg116 = load %list* %reg115, ubyte 0                  ;;<%list*>
+        %reg116 = load %list* %reg115, uint 0, ubyte 0                  ;;<%list*>
         br label %bb2
 end
index cb867c06bafbac10130f59ac89ea6615d6fc5e6c..9b0630aa7fab90bb0468c1ec7710746b6683e67c 100644 (file)
@@ -5,17 +5,17 @@ implementation
 
 int "test function"(int %i0, int %j0)
 begin
-    alloca [ubyte], uint 5
+    alloca ubyte, uint 5
     %ptr = alloca int                       ; yields {int*}:ptr
     store int 3, int* %ptr                  ; yields {void}
     %val = load int* %ptr                   ; yields {int}:val = int %3
 
     %sptr = alloca %struct                  ; yields {%struct*}:sptr
-    %nsptr = getelementptr %struct * %sptr, ubyte 1  ; yields {inners*}:nsptr
-    %ubsptr = getelementptr %inners * %nsptr, ubyte 1  ; yields {{ubyte}*}:ubsptr
-    store ubyte 4, {ubyte} * %ubsptr, ubyte 0
+    %nsptr = getelementptr %struct * %sptr, uint 0, ubyte 1  ; yields {inners*}:nsptr
+    %ubsptr = getelementptr %inners * %nsptr, uint 0, ubyte 1  ; yields {{ubyte}*}:ubsptr
+    store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
     
-    %fptr = getelementptr %struct * %sptr, ubyte 1, ubyte 0  ; yields {float*}:fptr
+    %fptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 0  ; yields {float*}:fptr
     store float 4.0, float * %fptr
     
     ret int 3
index a894c3d2a3afd6684f730e7528f6a37b4772145a..baf1c1d5ff7bf954d4458d1225cccd09c03611db 100644 (file)
@@ -1,29 +1,22 @@
-%somestr = constant [sbyte] c"hello world"
 %somestr = constant [11x sbyte] c"hello world"
-%array   = constant [[2 x int]]  [ [2 x int] [ int 12, int 52 ] ]
+%array   = constant [2 x int] [ int 12, int 52 ]
            constant { int, int } { int 4, int 3 }
 
 implementation
  
-[[2 x int]]* "test function"(int %i0, int %j0)
+[2 x int]* "test function"(int %i0, int %j0)
 begin
-       ret [[2x int]]* %array
+       ret [2x int]* %array
 end
 
-[sbyte]* "other func"(int, double)
+sbyte* "other func"(int, double)
 begin
-       ret [sbyte]* %somestr
+       %somestr = getelementptr [11x sbyte]* %somestr, uint 0, uint 0
+       ret sbyte* %somestr
 end
 
-[sbyte]* "yet another func"(int, double)
+sbyte* "yet another func"(int, double)
 begin
-       ret [sbyte]* null            ; Test null
-end
-
-
-[sbyte]* "again"(float)
-begin
-       %cast = cast [11x sbyte]* %somestr to [sbyte]*
-       ret [sbyte]* %cast
+       ret sbyte* null            ; Test null
 end
 
index b65c4f3fcb4ba72dd3eae4088e925f32e26c449b..b2cf0518cc3491e246c2c51299004ab694d1b116 100644 (file)
@@ -1,5 +1,5 @@
 %struct = type { int , {float, {ubyte } } , ulong }
-%complexty = type [{int, {[4 x sbyte *], float}, double}]
+%complexty = type {int, {[4 x sbyte *], float}, double}
 
 implementation
 
@@ -13,13 +13,13 @@ int "testfunction"(uint %i0, uint %j0)
 begin
     %array0 = malloc [4 x ubyte]            ; yields {[4 x ubyte]*}:array0
     %size   = add uint 2, 2                 ; yields {uint}:size = uint %4
-    %array1 = malloc [ubyte], uint 4        ; yields {[ubyte]*}:array1
-    %array2 = malloc [ubyte], uint %size    ; yields {[ubyte]*}:array2
+    %array1 = malloc ubyte, uint 4          ; yields {ubyte*}:array1
+    %array2 = malloc ubyte, uint %size      ; yields {ubyte*}:array2
 
-    store ubyte 123, [4 x ubyte]* %array0, uint 2
+    store ubyte 123, [4 x ubyte]* %array0, uint 0, uint 2
     free [4x ubyte]* %array0
-    free [ubyte]* %array1
-    free [ubyte]* %array2
+    free ubyte* %array1
+    free ubyte* %array2
 
 
     %aa = alloca %complexty, uint 5
@@ -30,8 +30,8 @@ begin
     %val = load int* %ptr                   ; yields {int}:val = int %3
 
     %sptr = alloca %struct                  ; yields {%struct*}:sptr
-    %ubsptr = getelementptr %struct * %sptr, ubyte 1, ubyte 1  ; yields {{ubyte}*}:ubsptr
-    store ubyte 4, {ubyte} * %ubsptr, ubyte 0
+    %ubsptr = getelementptr %struct * %sptr, uint 0, ubyte 1, ubyte 1  ; yields {{ubyte}*}:ubsptr
+    store ubyte 4, {ubyte} * %ubsptr, uint 0, ubyte 0
 
     ret int 3
 end
index cf757f100e53c17f1815bdd7eef28a85023c54b2..12cf652d158132a7c9e17a8d4ac4906b7e787b8e 100644 (file)
@@ -22,7 +22,7 @@ begin
        %v1 = load int* %MyVar
        call void %print(int %v1)    ;; Should start out 4
 
-       %v2 = load { \2 *, int }* %MyIntList, ubyte 1
+       %v2 = load { \2 *, int }* %MyIntList, uint 0, ubyte 1
        call void %print(int %v2)    ;; Should start out 17
 
        call int %foo(int 5)         ;; Modify global variablesx
@@ -30,7 +30,7 @@ begin
        %v3 = load int* %MyVar
        call void %print(int %v3)    ;; Should now be 5
 
-       %v4 = load { \2 *, int }* %MyIntList, ubyte 1
+       %v4 = load { \2 *, int }* %MyIntList, uint 0, ubyte 1
        call void %print(int %v4)    ;; Should start out 12
 
        ret void
index 056daaff09e531a53e168924db05a76ffa032360..5aacf1a95b2192f257ba5f38d78bebf40ea0c365 100644 (file)
@@ -17,7 +17,7 @@ implementation
 int "foo"(int %blah)
 begin
        store int %blah, int *%MyVar
-       store int 12, { \2 *, int } * %MyIntList, ubyte 1
+       store int 12, { \2 *, int } * %MyIntList, uint 0, ubyte 1
 
        %ack = load int * %0   ;; Load from the unnamed constant
        %fzo = add int %ack, %blah
diff --git a/test/ackermann.ll b/test/ackermann.ll
deleted file mode 100644 (file)
index 541ccde..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-%__intern_LC0 = global [sbyte] c"Ack(3, \00"
-%__intern_LC1 = global [sbyte] c") = \00"
-%__intern_LC2 = global [sbyte] c"\0A\00"               ; <[15 x sbyte] *>      [#uses=1]
-implementation
-
-declare void "__main"()
-
-declare void "printVal"([sbyte] *)
-declare void "printInt"(int)
-
-declare int "atoi"(sbyte *)
-
-int "main"(int %argc, sbyte * * %argv)
-begin
-bb1:                                   ;[#uses=1]
-       call void () * %__main( )
-       %cond1002 = setne int %argc, 2          ; <bool>        [#uses=1]
-       br bool %cond1002, label %bb4, label %bb2
-
-bb2:                                   ;[#uses=2]
-       %cast1010 = cast ulong 8 to sbyte * *           ; <sbyte * *>   [#uses=1]
-       %reg1003 = add sbyte * * %argv, %cast1010               ; <sbyte * *>   [#uses=1]
-       %reg110 = load sbyte * * %reg1003               ; <sbyte *>     [#uses=1]
-       %reg109 = call int (sbyte *) * %atoi( sbyte * %reg110 )         ; <int> [#uses=1]
-       br label %bb4
-
-bb4:                                   ;[#uses=2]
-       %reg132 = phi int [ %reg109, %bb2 ], [ 5, %bb1 ]                ; <int> [#uses=4]
-       %cond1004 = setne ulong 3, 0            ; <bool>        [#uses=1]
-       br bool %cond1004, label %bb6, label %bb5
-
-bb5:                                   ;[#uses=2]
-       %reg115 = add int %reg132, 1            ; <int> [#uses=1]
-       br label %bb9
-
-bb6:                                   ;[#uses=1]
-       %cond1005 = setne int %reg132, 0                ; <bool>        [#uses=1]
-       br bool %cond1005, label %bb8, label %bb7
-
-bb7:                                   ;[#uses=2]
-       %cast1006 = cast ulong 1 to int         ; <int> [#uses=1]
-       %cast1007 = cast ulong 2 to int         ; <int> [#uses=1]
-       %reg119 = call int (int, int) * %Ack( int %cast1007, int %cast1006 )            ; <int> [#uses=1]
-       br label %bb9
-
-bb8:                                   ;[#uses=2]
-       %reg121 = add int %reg132, -1           ; <int> [#uses=1]
-       %cast1008 = cast ulong 3 to int         ; <int> [#uses=1]
-       %reg122 = call int (int, int) * %Ack( int %cast1008, int %reg121 )              ; <int> [#uses=1]
-       %cast1009 = cast ulong 2 to int         ; <int> [#uses=1]
-       %reg124 = call int (int, int) * %Ack( int %cast1009, int %reg122 )              ; <int> [#uses=1]
-       br label %bb9
-
-bb9:                                   ;[#uses=3]
-       %reg135 = phi int [ %reg124, %bb8 ], [ %reg119, %bb7 ], [ %reg115, %bb5 ]               ; <int> [#uses=1]
-       call void %printVal([sbyte] *%__intern_LC0)
-       call void %printInt(int %reg132)
-       call void %printVal([sbyte] *%__intern_LC1)
-       call void %printInt(int %reg135)
-       call void %printVal([sbyte] *%__intern_LC2)
-       ret int 0
-end
-
-int "Ack"(int %M, int %N)
-begin
-bb1:                                   ;[#uses=2]
-       br label %bb2
-
-bb2:                                   ;[#uses=3]
-       %reg121 = phi int [ %reg117, %bb6 ], [ 1, %bb5 ], [ %N, %bb1 ]          ; <int> [#uses=3]
-       %reg122 = phi int [ %reg115, %bb6 ], [ %reg123, %bb5 ], [ %M, %bb1 ]            ; <int> [#uses=4]
-       %cond1000 = setne int %reg122, 0                ; <bool>        [#uses=1]
-       br bool %cond1000, label %bb4, label %bb3
-
-bb3:                                   ;[#uses=1]
-       %reg109 = add int %reg121, 1            ; <int> [#uses=1]
-       ret int %reg109
-
-bb4:                                   ;[#uses=1]
-       %cond1001 = setne int %reg121, 0                ; <bool>        [#uses=1]
-       br bool %cond1001, label %bb6, label %bb5
-
-bb5:                                   ;[#uses=3]
-       %reg123 = add int %reg122, -1           ; <int> [#uses=1]
-       br label %bb2
-
-bb6:                                   ;[#uses=3]
-       %reg115 = add int %reg122, -1           ; <int> [#uses=1]
-       %reg116 = add int %reg121, -1           ; <int> [#uses=1]
-       %reg117 = call int (int, int) * %Ack( int %reg122, int %reg116 )                ; <int> [#uses=1]
-       br label %bb2
-end
diff --git a/test/fib.ll b/test/fib.ll
deleted file mode 100644 (file)
index 6d81174..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-%FmtString1 = constant [ubyte] c"fib = \00"
-%FmtString2 = constant [ubyte] c"\0A\00"
-
-declare int "atoi"(sbyte *)
-declare void "printInt"(int)
-declare void "printString"([ubyte]*)
-
-implementation
-
-ulong "fib"(ulong %n)
-begin
-  setlt ulong %n, 2       ; {bool}:0
-  br bool %0, label %BaseCase, label %RecurseCase
-
-BaseCase:
-  ret ulong 1
-
-RecurseCase:
-  %n2 = sub ulong %n, 2
-  %n1 = sub ulong %n, 1
-  %f2 = call ulong(ulong) * %fib(ulong %n2)
-  %f1 = call ulong(ulong) * %fib(ulong %n1)
-  %result = add ulong %f2, %f1
-  ret ulong %result
-end
-
-ulong "realmain"(int %argc, sbyte ** %argv)
-begin
-  seteq int %argc, 2      ; {bool}:0
-  br bool %0, label %HasArg, label %Continue
-HasArg:
-  ; %n1 = atoi(argv[1])
-  %n1 = add int 1, 1
-  br label %Continue
-
-Continue:
-  %n = phi int [%n1, %HasArg], [1, %0]
-  %N = cast int %n to ulong
-  %F = call ulong(ulong) *%fib(ulong %N)
-  ret ulong %F
-end
-
-int "main"()
-begin
-  %Result = call ulong %fib(ulong 10)
-  %Result = cast ulong %Result to int
-  call void %printString([ubyte]* %FmtString1)
-  call void %printInt(int %Result)
-  call void %printString([ubyte]* %FmtString2)
-  ret int %Result
-end
-
diff --git a/test/fib2.ll b/test/fib2.ll
deleted file mode 100644 (file)
index 2adb8f1..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-%__intern_LC0 = constant [sbyte] c"fib returned: \00"
-%__intern_LC1 = constant [sbyte] c"\0A\00"
-
-implementation
-
-declare void "__main"()
-
-declare int "atoi"(sbyte *)
-
-declare void "printVal"([sbyte] *)
-declare void "printUInt"(uint)
-
-int "main"(int %argc, sbyte * * %argv)
-begin
-bb1:                                   ;[#uses=1]
-       call void () * %__main( )
-       %cond1003 = setne int %argc, 2          ; <bool>        [#uses=1]
-       br bool %cond1003, label %bb4, label %bb2
-
-bb2:                                   ;[#uses=2]
-       %cast1006 = cast ulong 8 to sbyte * *           ; <sbyte * *>   [#uses=1]
-       %reg1004 = add sbyte * * %argv, %cast1006               ; <sbyte * *>   [#uses=1]
-       %reg110 = load sbyte * * %reg1004               ; <sbyte *>     [#uses=1]
-       %reg109 = call int (sbyte *) * %atoi( sbyte * %reg110 )         ; <int> [#uses=1]
-       br label %bb4
-
-bb4:                                   ;[#uses=3]
-       %reg126 = phi int [ %reg109, %bb2 ], [ 15, %bb1 ]               ; <int> [#uses=3]
-       %cast1007 = cast int %reg126 to uint            ; <uint>        [#uses=1]
-       %cond1005 = setgt uint %cast1007, 1             ; <bool>        [#uses=1]
-       br bool %cond1005, label %bb6, label %bb7
-
-bb6:                                   ;[#uses=2]
-       %reg115 = add int %reg126, -2           ; <int> [#uses=1]
-       %cast1008 = cast int %reg115 to uint            ; <uint>        [#uses=1]
-       %reg116 = call uint (uint) * %fib( uint %cast1008 )             ; <uint>        [#uses=1]
-       %reg118 = add int %reg126, -1           ; <int> [#uses=1]
-       %cast1009 = cast int %reg118 to uint            ; <uint>        [#uses=1]
-       %reg119 = call uint (uint) * %fib( uint %cast1009 )             ; <uint>        [#uses=1]
-       %reg127 = add uint %reg116, %reg119             ; <uint>        [#uses=1]
-       br label %bb7
-
-bb7:                                   ;[#uses=2]
-       %reg128 = phi uint [ %reg127, %bb6 ], [ 1, %bb4 ]               ; <uint>        [#uses=1]
-       call void %printVal([sbyte] * %__intern_LC0)
-       call void %printUInt(uint %reg128 )
-       call void %printVal([sbyte] * %__intern_LC1)
-       ret int 0
-end
-
-uint "fib"(uint %n)
-begin
-bb1:                                   ;[#uses=0]
-       %cond1000 = setgt uint %n, 1            ; <bool>        [#uses=1]
-       br bool %cond1000, label %bb3, label %bb2
-
-bb2:                                   ;[#uses=1]
-       ret uint 1
-
-bb3:                                   ;[#uses=1]
-       %cast1001 = cast long -2 to uint                ; <uint>        [#uses=1]
-       %reg112 = add uint %n, %cast1001                ; <uint>        [#uses=1]
-       %reg113 = call uint (uint) * %fib( uint %reg112 )               ; <uint>        [#uses=1]
-       %cast1002 = cast long -1 to uint                ; <uint>        [#uses=1]
-       %reg115 = add uint %n, %cast1002                ; <uint>        [#uses=1]
-       %reg116 = call uint (uint) * %fib( uint %reg115 )               ; <uint>        [#uses=1]
-       %reg110 = add uint %reg113, %reg116             ; <uint>        [#uses=1]
-       ret uint %reg110
-end