[PATCH] D27556: LTO: Hash the parts of the LTO configuration that affect code generation.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 19:40:02 PST 2016


pcc added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/CommandFlags.h:235
 
+cl::opt<bool> RelaxELFRelocations(
+    "relax-elf-relocations",
----------------
tejohnson wrote:
> Why is this new option being added here?
This is so that I can test the effect of turning on RelaxELFRelocations from llvm-lto2. There's currently no other way to do it.

This should probably have been added when the codegen flag was added. Somewhat surprisingly it looks like we are only testing this via clang (see `clang/test/CodeGen/relax.c`).


================
Comment at: llvm/lib/LTO/LTO.cpp:85
+  // FIXME: Hash more of Options. For now all clients initialize Options from
+  // command-line flags (which is unsupported in production), but may set
+  // RelaxELFRelocations.
----------------
tejohnson wrote:
> I don't understand the comment about all clients initializing Options from command line flags, but it being unsupported in production.
Both gold and lld read code generation options using `InitTargetOptionsFromCodeGenFlags` (see [0] for gold and [1] for lld), which reads command line flags passed via `-plugin-opt` (for gold) or `-mllvm` (for lld). I don't think we officially support either of those flags though; they should be considered more like debugging aids or at best like `clang -cc1` flags in that they should only be used by the toolchain to communicate with itself. So we don't actually need to hash any of those flags except for those being used by a client (either directly or indirectly by e.g. the clang driver).

Actually didn't you add support for passing through `-function-sections` and `-data-sections`? I guess we'll need to hash that as well. And someone else added `-debugger-tune` [2], so I guess we can add that to the pile.

[0] http://llvm-cs.pcc.me.uk/tools/llvm-lto/llvm-lto.cpp#749
[1] http://llvm-cs.pcc.me.uk/tools/lld/ELF/LTO.cpp#72
[2] http://llvm-cs.pcc.me.uk/?q=%22-plugin-opt


https://reviews.llvm.org/D27556





More information about the llvm-commits mailing list