Rename AddReadAttrs to FunctionAttrs, and teach it how
[oota-llvm.git] / test / Transforms / FunctionAttrs / 2008-12-31-NoCapture.ll
1 ; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep {@c.*nocapture}
2 ; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep nocapture | count 3
3 @g = global i32* null           ; <i32**> [#uses=1]
4
5 define i32* @c1(i32* %p) {
6         ret i32* %p
7 }
8
9 define void @c2(i32* %p) {
10         store i32* %p, i32** @g
11         ret void
12 }
13
14 define void @c3(i32* %p) {
15         call void @c2(i32* %p)
16         ret void
17 }
18
19 define i32 @nc1(i32* %p) {
20         %tmp = bitcast i32* %p to i32*          ; <i32*> [#uses=2]
21         %val = load i32* %tmp           ; <i32> [#uses=1]
22         store i32 0, i32* %tmp
23         ret i32 %val
24 }
25
26 define void @nc2(i32* %p) {
27         %1 = call i32 @nc1(i32* %p)             ; <i32> [#uses=0]
28         ret void
29 }
30
31 define void @nc3(void ()* %f) {
32         call void %f()
33         ret void
34 }