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

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 11:55:43 PDT 2021


xbolva00 added a comment.

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)


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