blob: 0cf1cb7c638d6a308c42db2f83692e8b4b2b2846 [file] [log] [blame]
Nick Lewyckyc2ec0722013-07-06 00:29:58 +00001; RUN: opt < %s -functionattrs -S | FileCheck %s
Duncan Sandsb193a372009-01-02 11:54:37 +00002
Nick Lewyckyc2ec0722013-07-06 00:29:58 +00003; CHECK: define i32* @a(i32** nocapture readonly %p)
Duncan Sands289f59f2009-01-07 19:39:06 +00004define i32* @a(i32** %p) {
5 %tmp = load i32** %p
6 ret i32* %tmp
7}
Duncan Sandsb193a372009-01-02 11:54:37 +00008
Nick Lewyckyc2ec0722013-07-06 00:29:58 +00009; CHECK: define i32* @b(i32* %q)
Duncan Sands289f59f2009-01-07 19:39:06 +000010define i32* @b(i32 *%q) {
11 %mem = alloca i32*
12 store i32* %q, i32** %mem
13 %tmp = call i32* @a(i32** %mem)
14 ret i32* %tmp
Duncan Sandsb193a372009-01-02 11:54:37 +000015}
Nick Lewyckyc2ec0722013-07-06 00:29:58 +000016
17; CHECK: define i32* @c(i32* readnone %r)
18@g = global i32 0
19define i32* @c(i32 *%r) {
20 %a = icmp eq i32* %r, null
21 store i32 1, i32* @g
22 ret i32* %r
23}