[llvm] 3f1c65a - [FunctionAttrs] Add tests for inaccessiblememonly (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 23 05:45:47 PDT 2022


Author: Nikita Popov
Date: 2022-09-23T14:45:36+02:00
New Revision: 3f1c65a33dd8acdc3e0460fddfd1f7128fba3007

URL: https://github.com/llvm/llvm-project/commit/3f1c65a33dd8acdc3e0460fddfd1f7128fba3007
DIFF: https://github.com/llvm/llvm-project/commit/3f1c65a33dd8acdc3e0460fddfd1f7128fba3007.diff

LOG: [FunctionAttrs] Add tests for inaccessiblememonly (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/FunctionAttrs/argmemonly.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
index 000f374d1279..204c609f5a77 100644
--- a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
+++ b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll
@@ -107,6 +107,7 @@ entry:
 declare i32 @fn_argmemonly(i32*) argmemonly
 
 define i32 @test_call_argmemonly(i32* %ptr) {
+; CHECK: Function Attrs: argmemonly
 ; CHECK-LABEL: @test_call_argmemonly(
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:    [[C:%.*]] = call i32 @fn_argmemonly(i32* [[PTR:%.*]])
@@ -190,3 +191,47 @@ entry:
   %l.2 = load i32, i32* %a
   ret i32 %l.2
 }
+
+declare void @fn_inaccessiblememonly() inaccessiblememonly
+
+define void @test_inaccessiblememonly() {
+; CHECK-LABEL: @test_inaccessiblememonly(
+; CHECK-NEXT:    call void @fn_inaccessiblememonly()
+; CHECK-NEXT:    ret void
+;
+  call void @fn_inaccessiblememonly()
+  ret void
+}
+
+define void @test_inaccessiblememonly_readonly() {
+; CHECK: Function Attrs: nofree readonly
+; CHECK-LABEL: @test_inaccessiblememonly_readonly(
+; CHECK-NEXT:    call void @fn_inaccessiblememonly() #[[ATTR13:[0-9]+]]
+; CHECK-NEXT:    ret void
+;
+  call void @fn_inaccessiblememonly() readonly
+  ret void
+}
+
+define void @test_inaccessibleorargmemonly_readonly(i32* %arg) {
+; CHECK: Function Attrs: nofree readonly
+; CHECK-LABEL: @test_inaccessibleorargmemonly_readonly(
+; CHECK-NEXT:    [[TMP1:%.*]] = load i32, i32* [[ARG:%.*]], align 4
+; CHECK-NEXT:    call void @fn_inaccessiblememonly() #[[ATTR13]]
+; CHECK-NEXT:    ret void
+;
+  load i32, i32* %arg
+  call void @fn_inaccessiblememonly() readonly
+  ret void
+}
+
+define void @test_inaccessibleorargmemonly_readwrite(i32* %arg) {
+; CHECK-LABEL: @test_inaccessibleorargmemonly_readwrite(
+; CHECK-NEXT:    store i32 0, i32* [[ARG:%.*]], align 4
+; CHECK-NEXT:    call void @fn_inaccessiblememonly() #[[ATTR13]]
+; CHECK-NEXT:    ret void
+;
+  store i32 0, i32* %arg
+  call void @fn_inaccessiblememonly() readonly
+  ret void
+}


        


More information about the llvm-commits mailing list