diff --git a/llvm/test/Transforms/FunctionAttrs/writeonly.ll b/llvm/test/Transforms/FunctionAttrs/writeonly.ll index 633068129eac69..01c2139dbadf64 100644 --- a/llvm/test/Transforms/FunctionAttrs/writeonly.ll +++ b/llvm/test/Transforms/FunctionAttrs/writeonly.ll @@ -317,3 +317,48 @@ define void @fptr_test3(ptr %p, ptr %f) { call void %f(ptr nocapture %p) writeonly ret void } + +define void @test_argmem_none_callee(ptr %p) { +; FNATTRS-LABEL: define {{[^@]+}}@test_argmem_none_callee +; FNATTRS-SAME: (ptr nocapture [[P:%.*]]) { +; FNATTRS-NEXT: call void @direct1_callee(ptr nocapture [[P]]) #[[ATTR9:[0-9]+]] +; FNATTRS-NEXT: ret void +; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@test_argmem_none_callee +; ATTRIBUTOR-SAME: (ptr nocapture [[P:%.*]]) { +; ATTRIBUTOR-NEXT: call void @direct1_callee(ptr nocapture [[P]]) #[[ATTR8:[0-9]+]] +; ATTRIBUTOR-NEXT: ret void +; + call void @direct1_callee(ptr nocapture %p) memory(readwrite, argmem: none) + ret void +} + +define void @test_argmem_read_callee(ptr %p) { +; FNATTRS-LABEL: define {{[^@]+}}@test_argmem_read_callee +; FNATTRS-SAME: (ptr nocapture [[P:%.*]]) { +; FNATTRS-NEXT: call void @direct1_callee(ptr nocapture [[P]]) #[[ATTR10:[0-9]+]] +; FNATTRS-NEXT: ret void +; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@test_argmem_read_callee +; ATTRIBUTOR-SAME: (ptr nocapture [[P:%.*]]) { +; ATTRIBUTOR-NEXT: call void @direct1_callee(ptr nocapture [[P]]) #[[ATTR9:[0-9]+]] +; ATTRIBUTOR-NEXT: ret void +; + call void @direct1_callee(ptr nocapture %p) memory(readwrite, argmem: read) + ret void +} + +define void @test_argmem_write_callee(ptr %p) { +; FNATTRS-LABEL: define {{[^@]+}}@test_argmem_write_callee +; FNATTRS-SAME: (ptr nocapture [[P:%.*]]) { +; FNATTRS-NEXT: call void @direct1_callee(ptr nocapture [[P]]) #[[ATTR11:[0-9]+]] +; FNATTRS-NEXT: ret void +; +; ATTRIBUTOR-LABEL: define {{[^@]+}}@test_argmem_write_callee +; ATTRIBUTOR-SAME: (ptr nocapture [[P:%.*]]) { +; ATTRIBUTOR-NEXT: call void @direct1_callee(ptr nocapture [[P]]) #[[ATTR10:[0-9]+]] +; ATTRIBUTOR-NEXT: ret void +; + call void @direct1_callee(ptr nocapture %p) memory(readwrite, argmem: write) + ret void +}