1 ; RUN: opt -S -o - -functionattrs %s | FileCheck %s
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 ; Function Attrs: argmemonly
8 define i32* @given_argmem_infer_readnone(i32* %p) #0 {
9 ; CHECK: define i32* @given_argmem_infer_readnone(i32* readnone returned %p) #0 {
14 ; Function Attrs: inaccessiblememonly
15 define i32* @given_inaccessible_infer_readnone(i32* %p) #1 {
16 ; CHECK: define i32* @given_inaccessible_infer_readnone(i32* readnone returned %p) #0 {
21 ; Function Attrs: inaccessiblemem_or_argmemonly
22 define i32* @given_inaccessible_or_argmem_infer_readnone(i32* %p) #2 {
23 ; CHECK: define i32* @given_inaccessible_or_argmem_infer_readnone(i32* readnone returned %p) #0 {
28 attributes #0 = { argmemonly }
29 attributes #1 = { inaccessiblememonly }
30 attributes #2 = { inaccessiblemem_or_argmemonly }
31 ; CHECK: attributes #0 = { norecurse nounwind readnone }
32 ; CHECK-NOT: attributes