[PATCH] D98183: [libLTO] Add support for -save-temps.

Qiongsi Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 15:00:27 PDT 2023

qiongsiwu1 added a comment.

> I wouldn't want to rename the existing flag in llvm-lto2, since a ton of tests already use it.
> It looks like the convention in LTOCodeGenerator.cpp is to preface options with "lto-", so perhaps that one should be -lto-save-temps. That would also be more consistent with the -thinlto-save-temps option used for ThinLTOCodeGenerator.cpp (defined in llvm-lto.cpp).
> While it could work to use the same option, it seems a bit odd to share in this case. I think it only works in this case because llvm-lto2 depends on the LTO library which currently includes the code for both LTO APIs, even though llvm-lto2 doesn't use the legacy one.

@tejohnson Thanks so much for the suggestion! The new option is renamed to `-lto-save-temps` to avoid the conflict with `llvm-lto2`. I took a brief look to see if we can consolidate the option with thin LTO. My current understanding is that `ThinLTOCodeGenerator` and `LTOCodeGenerator` work quite differently so it may require further changes to consolidate the two. I am inclined to leave this patch in its current shape. That said, I don't have a lot of experience with thin LTO so I may over estimate the difficulty. Let me know if you think otherwise and I will take a closer look.

A test is added as well to test the LTOGenerator feature as it is.

  rG LLVM Github Monorepo



More information about the llvm-commits mailing list