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

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 10:43:34 PST 2019


thegameg marked an inline comment as done.
thegameg added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:433
+  bool ExpectPathNext = false;
+  for (Arg *A : Args) {
+    if (ExpectPathNext) {
----------------
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`).


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

https://reviews.llvm.org/D70577





More information about the llvm-commits mailing list