[PATCH] D130806: [InstrProf] Allow noprofile functions to be inlined

Marco Elver via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 01:05:49 PDT 2022


melver added a comment.

In D130806#3695022 <https://reviews.llvm.org/D130806#3695022>, @ellis wrote:

> In D130806#3694879 <https://reviews.llvm.org/D130806#3694879>, @nickdesaulniers wrote:
>
>> I observed no new build or runtime warnings when compiling the linux kernel with gcov enabled (CONFIG_GCOV_KERNEL=y + CONFIG_GCOV_PROFILE_ALL=y) or kcsan (CONFIG_KCSAN=y) (x86).
>
> Thanks for checking!

If a callee with the noprofile attribute is inlined into a profiled function, will it then also be profiled?
Is it possible that a noprofile function could receive instrumentation through inlining now?

If so, this is wrong and will cause problems. Perhaps for profiling instrumentation it works differently, but for the sanitizers this was an issue we fought for a while to get right everywhere: https://lore.kernel.org/lkml/CANpmjNNRz5OVKb6PE7K6GjfoGbht_ZhyPkNG9aD+KjNDzK7hGg@mail.gmail.com/



================
Comment at: llvm/test/Transforms/Inline/inline_noprofile.ll:22
 
-define i32 @noprofile_caller() {
-; CHECK-LABEL: @noprofile_caller(
-; CHECK-NEXT:    [[TMP1:%.*]] = call i32 @noprofile()
-; CHECK-NEXT:    ret i32 45
-;
-  call i32 @noprofile()
-  %2 = call i32 @noprofile_aa()
-  ret i32 %2
-}
-
-; Test that we do inline when caller and callee don't have matching
-; noprofile fn attrs, when CallInst is alwaysinline.
-define i32 @aa_callsite() {
+; Test that we do inline profiled callees into no profile callers when CallInst
+; is alwaysinline
----------------
noprofile (no space)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130806



More information about the llvm-commits mailing list