xref: /llvm-project/llvm/test/Transforms/FunctionAttrs/readnone.ll (revision 29441e4f5fa5f5c7709f7cf180815ba97f611297)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2; RUN: opt -passes=function-attrs -S < %s | FileCheck --check-prefixes=COMMON,FNATTRS %s
3; RUN: opt -passes=attributor-light -S < %s | FileCheck --check-prefixes=COMMON,ATTRIBUTOR %s
4
5define void @bar(ptr readonly %0) {
6; FNATTRS-LABEL: define void @bar(
7; FNATTRS-SAME: ptr readnone captures(none) [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
8; FNATTRS-NEXT:    call void @foo(ptr [[TMP0]])
9; FNATTRS-NEXT:    ret void
10;
11; ATTRIBUTOR-LABEL: define void @bar(
12; ATTRIBUTOR-SAME: ptr nofree readnone captures(none) [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
13; ATTRIBUTOR-NEXT:    call void @foo(ptr nofree readnone captures(none) [[TMP0]]) #[[ATTR0]]
14; ATTRIBUTOR-NEXT:    ret void
15;
16  call void @foo(ptr %0)
17  ret void
18}
19
20define void @foo(ptr readonly %0) {
21; FNATTRS-LABEL: define void @foo(
22; FNATTRS-SAME: ptr readnone captures(none) [[TMP0:%.*]]) #[[ATTR0]] {
23; FNATTRS-NEXT:    call void @bar(ptr [[TMP0]])
24; FNATTRS-NEXT:    ret void
25;
26; ATTRIBUTOR-LABEL: define void @foo(
27; ATTRIBUTOR-SAME: ptr nofree readnone captures(none) [[TMP0:%.*]]) #[[ATTR0]] {
28; ATTRIBUTOR-NEXT:    call void @bar(ptr nofree readnone captures(none) [[TMP0]]) #[[ATTR0]]
29; ATTRIBUTOR-NEXT:    ret void
30;
31  call void @bar(ptr %0)
32  ret void
33}
34;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
35; COMMON: {{.*}}
36