xref: /llvm-project/llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll (revision 304f1d59ca41872c094def3aee0a8689df6aa398)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
2; RUN: opt -S -o - -passes=function-attrs < %s | FileCheck %s
3
4; Verify we remove argmemonly/inaccessiblememonly/inaccessiblemem_or_argmemonly
5; function attributes when we derive readnone.
6
7define ptr @given_argmem_infer_readnone(ptr %p) #0 {
8; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
9; CHECK-LABEL: @given_argmem_infer_readnone(
10; CHECK-NEXT:  entry:
11; CHECK-NEXT:    ret ptr [[P:%.*]]
12;
13entry:
14  ret ptr %p
15}
16
17define ptr @given_inaccessible_infer_readnone(ptr %p) #1 {
18; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
19; CHECK-LABEL: @given_inaccessible_infer_readnone(
20; CHECK-NEXT:  entry:
21; CHECK-NEXT:    ret ptr [[P:%.*]]
22;
23entry:
24  ret ptr %p
25}
26
27define ptr @given_inaccessible_or_argmem_infer_readnone(ptr %p) #2 {
28; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
29; CHECK-LABEL: @given_inaccessible_or_argmem_infer_readnone(
30; CHECK-NEXT:  entry:
31; CHECK-NEXT:    ret ptr [[P:%.*]]
32;
33entry:
34  ret ptr %p
35}
36
37attributes #0 = { argmemonly }
38attributes #1 = { inaccessiblememonly }
39attributes #2 = { inaccessiblemem_or_argmemonly }
40