From e7f133191008b137aa9ef611b676ce2ec3c116a7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Sep 2022 13:55:36 +0200 Subject: [PATCH] [FunctionAttrs] Add test for argmemonly function that already has attr (NFC) Test for the issue reported in https://reviews.llvm.org/D134527#3821010. --- llvm/test/Transforms/FunctionAttrs/argmemonly.ll | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll index 204c609..1954f70 100644 --- a/llvm/test/Transforms/FunctionAttrs/argmemonly.ll +++ b/llvm/test/Transforms/FunctionAttrs/argmemonly.ll @@ -25,6 +25,18 @@ entry: ret i32 %l } +define i32 @test_only_read_arg_already_has_argmemonly(i32* %ptr) argmemonly { +; CHECK: Function Attrs: argmemonly mustprogress nofree norecurse nosync nounwind readonly willreturn +; CHECK-LABEL: @test_only_read_arg_already_has_argmemonly( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[L:%.*]] = load i32, i32* [[PTR:%.*]], align 4 +; CHECK-NEXT: ret i32 [[L]] +; +entry: + %l = load i32, i32* %ptr + ret i32 %l +} + define i32 @test_read_global() { ; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind readonly willreturn ; CHECK-LABEL: @test_read_global( -- 2.7.4