[InstrProf] Add the skipprofile attribute
authorEllis Hoag <ellis.sparky.hoag@gmail.com>
Fri, 29 Jul 2022 23:23:46 +0000 (16:23 -0700)
committerEllis Hoag <ellis.sparky.hoag@gmail.com>
Thu, 4 Aug 2022 15:45:27 +0000 (08:45 -0700)
commit12e78ff88105f2dc6cb1449d6fcd5d8f69e0512f
tree652e87fc7305b7d2d10eb24ca56bffe00af4fb11
parentec7f4a7c5d9794c9fdf4f894873e7edbbfddf3e2
[InstrProf] Add the skipprofile attribute

As discussed in [0], this diff adds the `skipprofile` attribute to
prevent the function from being profiled while allowing profiled
functions to be inlined into it. The `noprofile` attribute remains
unchanged.

The `noprofile` attribute is used for functions where it is
dangerous to add instrumentation to while the `skipprofile` attribute is
used to reduce code size or performance overhead.

[0] https://discourse.llvm.org/t/why-does-the-noprofile-attribute-restrict-inlining/64108

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D130807
14 files changed:
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/CodeGenPGO.cpp
clang/test/CodeGen/profile-function-groups.c
llvm/docs/LangRef.rst
llvm/include/llvm/Bitcode/LLVMBitCodes.h
llvm/include/llvm/IR/Attributes.td
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/test/Bitcode/attributes.ll
llvm/test/Transforms/GCOVProfiling/noprofile.ll
llvm/test/Transforms/PGOProfile/noprofile.ll