24 lines · plain
1; RUN: opt < %s -passes=function-attrs -S | FileCheck %s2 3; CHECK: define ptr @a(ptr readonly captures(none) %p)4define ptr @a(ptr %p) {5 %tmp = load ptr, ptr %p6 ret ptr %tmp7}8 9; CHECK: define ptr @b(ptr %q)10define ptr @b(ptr %q) {11 %mem = alloca ptr12 store ptr %q, ptr %mem13 %tmp = call ptr @a(ptr %mem)14 ret ptr %tmp15}16 17; CHECK: define ptr @c(ptr readnone returned captures(address_is_null, ret: address, provenance) %r)18@g = global i32 019define ptr @c(ptr %r) {20 %a = icmp eq ptr %r, null21 store i32 1, ptr @g22 ret ptr %r23}24