Changed all of these tests to be TestRunner tests (or, at least they can be
[oota-llvm.git] / test / Transforms / DSAnalysis / misctests.ll
1 ;
2 ; RUN: analyze %s -tddatastructure
3
4 int* %test1(int *%A) {
5         %R = getelementptr int* %A, long 1
6         ret int* %R
7 }
8
9 int* %test2(uint %Num) {
10         %A = malloc sbyte, uint %Num
11         %B = cast sbyte* %A to int*
12         ret int* %B
13 }
14
15 int* %test3(uint %Num) {
16         %A = malloc sbyte, uint %Num
17         %B = cast sbyte* %A to int*
18         %C = getelementptr int* %B, long 5
19         ret int* %C
20 }
21
22 int* %test4(bool %C, uint %Num) {
23         br bool %C, label %L1, label %L2
24 L1:
25         %A = malloc sbyte, uint %Num
26         %B = cast sbyte* %A to int*
27         br label %L3
28 L2:
29         %C = malloc int, uint %Num
30         br label %L3
31 L3:
32         %D = phi int* [%B, %L1], [%C, %L2]
33         %E = getelementptr int* %D, long 5
34         ret int* %E
35 }
36
37 int* %test5(bool %C, uint %Num) {
38         br bool %C, label %L1, label %L2
39 L1:
40         %C = malloc int, uint %Num
41         br label %L3
42 L2:
43         %A = malloc sbyte, uint %Num
44         %B = cast sbyte* %A to int*
45         br label %L3
46 L3:
47         %D = phi int* [%C, %L1], [%B, %L2]
48         %E = getelementptr int* %D, long 5
49         ret int* %E
50 }
51
52 int %test6({int, int}* %A) {
53         %B = getelementptr {int, int}* %A, long 0, ubyte 0
54         %b = load int* %B
55         %C = getelementptr {int, int}* %A, long 0, ubyte 1
56         %c = load int* %C
57         %d = add int %b, %c
58         ret int %d
59 }
60
61 sbyte* %test7(uint %Num) {
62         %X = malloc sbyte, uint %Num
63         %Y = getelementptr sbyte* %X, long 1
64         store sbyte 0, sbyte* %Y
65         ret sbyte* %X
66 }
67