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

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 12 21:50:35 PDT 2021


wenlei added a comment.

> More specifically, with the following command, both cc1 and lld will run in default mode, which is -O0 for cc1 and -O2 for lld.
>
>   clang -flto 1.cpp -v -fuse-ld=lld

I'm wondering is this the expected behavior or an oversight of pass pipeline setup? In what scenario would a O0 prelink + O2 <https://reviews.llvm.org/owners/package/2/> postlink make sense?

Btw, just double check - the O2 <https://reviews.llvm.org/owners/package/2/> here you mentioned is not LLD's O2 <https://reviews.llvm.org/owners/package/2/> for linking, but actually postlink LLVM O2 <https://reviews.llvm.org/owners/package/2/>, right?



================
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)
----------------
> 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? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109531



More information about the llvm-commits mailing list