2013-07-06 08:29:58 +08:00
|
|
|
; RUN: opt < %s -functionattrs -S | FileCheck %s
|
2009-01-02 19:54:37 +08:00
|
|
|
|
2013-07-06 08:29:58 +08:00
|
|
|
; CHECK: define i32* @a(i32** nocapture readonly %p)
|
2009-01-08 03:39:06 +08:00
|
|
|
define i32* @a(i32** %p) {
|
2015-02-28 05:17:42 +08:00
|
|
|
%tmp = load i32*, i32** %p
|
2009-01-08 03:39:06 +08:00
|
|
|
ret i32* %tmp
|
|
|
|
}
|
2009-01-02 19:54:37 +08:00
|
|
|
|
2013-07-06 08:29:58 +08:00
|
|
|
; CHECK: define i32* @b(i32* %q)
|
2009-01-08 03:39:06 +08:00
|
|
|
define i32* @b(i32 *%q) {
|
|
|
|
%mem = alloca i32*
|
|
|
|
store i32* %q, i32** %mem
|
|
|
|
%tmp = call i32* @a(i32** %mem)
|
|
|
|
ret i32* %tmp
|
2009-01-02 19:54:37 +08:00
|
|
|
}
|
2013-07-06 08:29:58 +08:00
|
|
|
|
|
|
|
; CHECK: define i32* @c(i32* readnone %r)
|
|
|
|
@g = global i32 0
|
|
|
|
define i32* @c(i32 *%r) {
|
|
|
|
%a = icmp eq i32* %r, null
|
|
|
|
store i32 1, i32* @g
|
|
|
|
ret i32* %r
|
|
|
|
}
|