1 ; This testcase tests for various features the basicaa test should be able to
2 ; determine, as noted in the comments.
4 ; RUN: if as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | dis | grep REMOVE
10 ; Array test: Test that operations on one local array do not invalidate
11 ; operations on another array. Important for scientific codes.
13 int %different_array_test(long %A, long %B) {
14 %Array1 = alloca int, uint 100
15 %Array2 = alloca int, uint 200
17 %pointer = getelementptr int* %Array1, long %A
18 %val = load int* %pointer
20 %pointer2 = getelementptr int* %Array2, long %B
21 store int 7, int* %pointer2
23 %REMOVE = load int* %pointer ; redundant with above load
24 %retval = sub int %REMOVE, %val
28 ; Constant index test: Constant indexes into the same array should not
29 ; interfere with each other. Again, important for scientific codes.
31 int %constant_array_index_test() {
32 %Array = alloca int, uint 100
33 %P1 = getelementptr int* %Array, long 7
34 %P2 = getelementptr int* %Array, long 6
37 store int 1, int* %P2 ; Should not invalidate load
38 %BREMOVE = load int* %P1
39 %Val = sub int %A, %BREMOVE
43 ; Test that if two pointers are spaced out by a constant getelementptr, that
45 int %gep_distance_test(int* %A) {
46 %REMOVEu = load int* %A
47 %B = getelementptr int* %A, long 2 ; Cannot alias A
49 %REMOVEv = load int* %A
50 %r = sub int %REMOVEu, %REMOVEv