9c904fa0e07e115d0f37684645ed7011c6bd00e7
[oota-llvm.git] / test / Analysis / DSGraph / FunctionPointerTable-const.ll
1 ; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=bu -dsgc-check-flags=Y:SHM && \
2 ; RUN: llvm-as < %s | opt -analyze -datastructure-gc -dsgc-dspass=td -dsgc-check-flags=P1:SHM,P2:SHM
3
4 %G = internal constant [2 x int*(int*)*] [ 
5   int*(int*)* %callee1, int*(int*)* %callee2
6 ]
7
8 implementation
9
10 internal int* %callee1(int* %P1) {
11         ret int* %P1
12 }
13
14 internal int* %callee2(int* %P2) {
15         %X = malloc int
16         ret int* %X
17 }
18
19 void %caller(int %callee) {
20         %FPP = getelementptr [2 x int*(int*)*]* %G, int 0, int %callee
21         %FP = load int*(int*)** %FPP
22
23         %Y = alloca int
24         %Z = call int* %FP(int* %Y)
25         store int 4, int* %Z
26         ret void
27 }