[llvm] 2c1799f - [IPSCCP] Add another test case with argmemonly callsite attributes.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 24 02:14:22 PDT 2020


Author: Florian Hahn
Date: 2020-07-24T10:13:51+01:00
New Revision: 2c1799f8928e1a63020fa8099d254c084f8be2f2

URL: https://github.com/llvm/llvm-project/commit/2c1799f8928e1a63020fa8099d254c084f8be2f2
DIFF: https://github.com/llvm/llvm-project/commit/2c1799f8928e1a63020fa8099d254c084f8be2f2.diff

LOG: [IPSCCP] Add another test case with argmemonly callsite attributes.

Added: 
    

Modified: 
    llvm/test/Transforms/SCCP/ipscp-drop-argmemonly.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SCCP/ipscp-drop-argmemonly.ll b/llvm/test/Transforms/SCCP/ipscp-drop-argmemonly.ll
index 898a61aee2e4..a110476eb430 100644
--- a/llvm/test/Transforms/SCCP/ipscp-drop-argmemonly.ll
+++ b/llvm/test/Transforms/SCCP/ipscp-drop-argmemonly.ll
@@ -128,3 +128,38 @@ define i32 @caller.5(i32 %n) {
   %g.val = load i32, i32* @g
   ret i32 %g.val
 }
+
+
+; Make sure callsite attributes are also dropped when a pointer argument is
+; replaced.
+define internal void @ptrarg.6.cs.attributes(i32* %arg, i32 %val) {
+; CHECK-LABEL: @ptrarg.6.cs.attributes(
+; CHECK-NEXT:    unreachable
+;
+  store i32 %val, i32* %arg
+  ret void
+}
+
+define i32 @caller.6.cs.attributes(i32 %n) {
+; CHECK-LABEL: @caller.6.cs.attributes(
+; CHECK-NEXT:    store i32 1, i32* @g, align 4
+; CHECK-NEXT:    tail call void @ptrarg.5(i32* @g, i32 10) [[ARGMEMONLY_INACCESSIBLEMEM_OR_ARGMEMONLY_NOUNWIND:#[0-9]+]]
+; CHECK-NEXT:    tail call void @ptrarg.5(i32* @g, i32 10) [[INACCESSIBLEMEM_OR_ARGMEMONLY_NOUNWIND:#[0-9]+]]
+; CHECK-NEXT:    tail call void @ptrarg.5(i32* @g, i32 10) [[ARGMEMONLY_NOUNWIND:#[0-9]+]]
+; CHECK-NEXT:    tail call void @ptrarg.5(i32* @g, i32 10) [[NOUNWIND:#[0-9]+]]
+; CHECK-NEXT:    [[G_VAL:%.*]] = load i32, i32* @g, align 4
+; CHECK-NEXT:    ret i32 [[G_VAL]]
+;
+  store i32 1, i32* @g
+  tail call void @ptrarg.5(i32* @g, i32 10) argmemonly inaccessiblemem_or_argmemonly nounwind
+  tail call void @ptrarg.5(i32* @g, i32 10) inaccessiblemem_or_argmemonly nounwind
+  tail call void @ptrarg.5(i32* @g, i32 10) argmemonly nounwind
+  tail call void @ptrarg.5(i32* @g, i32 10) nounwind
+  %g.val = load i32, i32* @g
+  ret i32 %g.val
+}
+
+; CHECK-DAG: [[ARGMEMONLY_INACCESSIBLEMEM_OR_ARGMEMONLY_NOUNWIND]] = { argmemonly inaccessiblemem_or_argmemonly nounwind }
+; CHECK-DAG: [[INACCESSIBLEMEM_OR_ARGMEMONLY_NOUNWIND]] = { inaccessiblemem_or_argmemonly nounwind }
+; CHECK-DAG: [[ARGMEMONLY_NOUNWIND]] = { argmemonly nounwind }
+; CHECK-DAG: [[NOUNWIND]] = { nounwind }


        


More information about the llvm-commits mailing list