[PATCH] D70577: [Remarks][LTO] Infer remarks file path from -object_path_lto

Steven Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 11:01:48 PST 2019


steven_wu added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:433
+  bool ExpectPathNext = false;
+  for (Arg *A : Args) {
+    if (ExpectPathNext) {
----------------
thegameg wrote:
> steven_wu wrote:
> > You can use a filtered iterator here. Also I think the last argument of the same type wins, rather than the first one.
> > 
> > This is rather ugly. Can you let linker pass the file path to you through LTO interface, rather to infer that from -Xlinker or -Wl option?
> I agree with you here. The reasons I went for this approach is that it avoids adding remark-specific logic to the LTO interface and the linker. The linker would need to know how to build a remark filename based on things like the format or whether it's ThinLTO or not.
> 
> Thinking more about this, maybe the best option is to never pass the path to the remark file unless it's explicitly specified by the user, and let the LTOCodeGenerator create the file if asked (through another option like `-lto-pass-remarks`).
I would argue that if LTO is missing the interface to support Remarks which is supported for normal compilation, adding an interface to libLTO is totally fine.

Using LTOCodeGenerator to write output remark file while writing out each object file sounds like a good idea. 


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

https://reviews.llvm.org/D70577





More information about the llvm-commits mailing list