blob: fdbb0ad6467d5fb6b80d1258f57dbf1ff2cd129a [file] [log] [blame]
Chris Lattnere4f318c2002-09-08 18:08:36 +00001; This testcase tests for various features the basicaa test should be able to
2; determine, as noted in the comments.
3
4; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep REMOVE
5; RUN: then exit 1
6; RUN: else exit 0
7; RUN: fi
8
9
10; Array test: Test that operations on one local array do not invalidate
11; operations on another array. Important for scientific codes.
12;
13int %different_array_test(uint %A, uint %B) {
14 %Array1 = alloca int, uint 100
15 %Array2 = alloca int, uint 200
16
17 %pointer = getelementptr int* %Array1, uint %A
18 %val = load int* %pointer
19
20 %pointer2 = getelementptr int* %Array2, uint %B
21 store int 7, int* %pointer2
22
23 %REMOVE = load int* %pointer ; redundant with above load
24 %retval = sub int %REMOVE, %val
25 ret int %retval
26}
27
28; Constant index test: Constant indexes into the same array should not
29; interfere with each other. Again, important for scientific codes.
30;
31int %constant_array_index_test() {
32 %Array = alloca int, uint 100
33 %P1 = getelementptr int* %Array, uint 7
34 %P2 = getelementptr int* %Array, uint 6
35
36 %A = load int* %P1
37 store int 1, int* %P2 ; Should not invalidate load
38 %BREMOVE = load int* %P1
39 %Val = sub int %A, %BREMOVE
40 ret int %Val
41}
42