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
4 ; Verify we remove argmemonly/inaccessiblememonly/inaccessiblemem_or_argmemonly
5 ; function attributes when we derive readnone.
7 define 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(
11 ; CHECK-NEXT: ret ptr [[P:%.*]]
17 define 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(
21 ; CHECK-NEXT: ret ptr [[P:%.*]]
27 define 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(
31 ; CHECK-NEXT: ret ptr [[P:%.*]]
37 attributes #0 = { argmemonly }
38 attributes #1 = { inaccessiblememonly }
39 attributes #2 = { inaccessiblemem_or_argmemonly }