blob: 86feb4318c6b0a5757e6bfde64042acd1cb8d2fe [file] [log] [blame]
Duncan Sands10109412008-12-31 20:21:34 +00001; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | not grep {nocapture *%%q}
2; RUN: llvm-as < %s | opt -functionattrs | llvm-dis | grep {nocapture *%%p} | count 3
Duncan Sands9e89ba32008-12-31 16:14:43 +00003@g = global i32* null ; <i32**> [#uses=1]
4
Duncan Sands10109412008-12-31 20:21:34 +00005define i32* @c1(i32* %q) {
6 ret i32* %q
Duncan Sands9e89ba32008-12-31 16:14:43 +00007}
8
Duncan Sands10109412008-12-31 20:21:34 +00009define void @c2(i32* %q) {
10 store i32* %q, i32** @g
Duncan Sands9e89ba32008-12-31 16:14:43 +000011 ret void
12}
13
Duncan Sands10109412008-12-31 20:21:34 +000014define void @c3(i32* %q) {
15 call void @c2(i32* %q)
Duncan Sands9e89ba32008-12-31 16:14:43 +000016 ret void
17}
18
Duncan Sands10109412008-12-31 20:21:34 +000019define i32 @nc1(i32* %q, i32* %p, i1 %b) {
20e:
21 br label %l
22l:
23 %x = phi i32* [ %p, %e ]
24 %y = phi i32* [ %q, %e ]
25 %tmp = bitcast i32* %x to i32* ; <i32*> [#uses=2]
26 %tmp2 = select i1 %b, i32* %tmp, i32* %y
27 %val = load i32* %tmp2 ; <i32> [#uses=1]
Duncan Sands9e89ba32008-12-31 16:14:43 +000028 store i32 0, i32* %tmp
Duncan Sands10109412008-12-31 20:21:34 +000029 store i32* %y, i32** @g
Duncan Sands9e89ba32008-12-31 16:14:43 +000030 ret i32 %val
31}
32
Duncan Sands10109412008-12-31 20:21:34 +000033define void @nc2(i32* %p, i32* %q) {
34 %1 = call i32 @nc1(i32* %q, i32* %p, i1 0) ; <i32> [#uses=0]
Duncan Sands9e89ba32008-12-31 16:14:43 +000035 ret void
36}
37
Duncan Sands10109412008-12-31 20:21:34 +000038define void @nc3(void ()* %p) {
39 call void %p()
Duncan Sands9e89ba32008-12-31 16:14:43 +000040 ret void
41}