[PATCH] D109531: [CSSPGO] Enable pseudo probe instrumentation in O0 mode.

Hongtao Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 13 09:08:00 PDT 2021


hoy added inline comments.


================
Comment at: llvm/lib/Passes/PassBuilder.cpp:1930
+  // mixed with an O0 prelink and an O2 postlink. Loading a sample profile in
+  // the postlink will require pseudo probe instrumentation in the prelink.
+  if (PGOOpt && PGOOpt->PseudoProbeForProfiling)
----------------
wenlei wrote:
> > Loading a sample profile in the postlink will require pseudo probe instrumentation in the prelink. 
> 
> Even with this change, is it still possible that prelink compile for some module actually doesn't have `-fpseudo-probe-for-profiling`, and it's on for LTO postlink? We could contrive such case, and it could happen in reality too, right? Would we have the same problem when trying to load profile for functions from modules without pseudo-probe in prelink? 
Yes, it could happen. The compiler will stop working too with the current implementation. We could change the error reporting to be a warning to make that pass. It is an error because we want to remind user if that's intentional.

I think it's mostly user's responsibility to be clear if pseudo probe instrumentation is needed or not, especially when passing linker flags separately. The change being made here is to ensure it works when all flags are passed via CXX_FLAGS, such as

clang -flto 1.cpp -v -fuse-ld=lld -fpseudo-probe-for-profiling -fprofile-sample-use=....


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109531



More information about the cfe-commits mailing list