From 2c1799f8928e1a63020fa8099d254c084f8be2f2 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 24 Jul 2020 09:59:03 +0100 Subject: [PATCH] [IPSCCP] Add another test case with argmemonly callsite attributes. --- .../Transforms/SCCP/ipscp-drop-argmemonly.ll | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) 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 }