[PATCH] D101011: [Attr] Add "noipa" function attribute

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 11:57:48 PDT 2021


dblaikie added a comment.

In D101011#2709748 <https://reviews.llvm.org/D101011#2709748>, @xbolva00 wrote:

> GCC docs: This attribute implies noinline, noclone and no_icf attributes. So for example:
>
>   diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
>   index 6b966e7ca133..a13b1755cedf 100644
>   --- a/clang/lib/CodeGen/CodeGenModule.cpp
>   +++ b/clang/lib/CodeGen/CodeGenModule.cpp
>   @@ -1757,6 +1757,10 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
>        // Naked implies noinline: we should not be inlining such functions.
>        B.addAttribute(llvm::Attribute::Naked);
>        B.addAttribute(llvm::Attribute::NoInline);
>   +  } else if (D->hasAttr<NoIPAAttr>()) {
>   +    // NoIPA implies noinline: we should not be inlining such functions.
>   +    B.addAttribute(llvm::Attribute::NoIPA);
>   +    B.addAttribute(llvm::Attribute::NoInline);
>      } else if (D->hasAttr<NoDuplicateAttr>()) {
>        B.addAttribute(llvm::Attribute::NoDuplicate);
>      } else if (D->hasAttr<NoInlineAttr>() && !F->hasFnAttribute(llvm::Attribute::AlwaysInline)) {
>
> (just PoC, not tested)

I think there's a reasonable argument to be made for keeping the attributes orthogonal - to implement the GCC compatible support in Clang we can always add both attributes in Clang's IRGen.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101011/new/

https://reviews.llvm.org/D101011



More information about the llvm-commits mailing list