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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to