With this patch, if you specify LLVM_ENABLE_LTO=Full or LLVM_ENABLE_LTO=On and you are using cl + link, we enable the /GL and /LTCG flags for the compiler and linker, respectively.
Diff Detail
Event Timeline
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
780 | Can you set ${style} to "OFF", "FULL", "MSVC", and "THIN" only? That way, dispatching on it won't have to worry about case and "ON" being an alias for "FULL". Also in the other passthrough case further down. |
- Updated with suggestions from inglorion. Specifically, decide_lto_style now either hard fails, or returns one of 4 values thin, full, msvc, none.
- Deletes the codepath for treating -flto separately from -flto=full. Since they are both the same, we just always use -flto=full
- Merge all the codepaths for the different styles into a single one. Instead of adding -flto=thin or -flto=full, we just add -flto=${LTO_STYLE}, collapsing some branches together.
- Enables the ThinLTO cache when using lld-link.
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
771 | What is "msvc"? (pointer to another doc accepted :)) |
llvm/cmake/modules/HandleLLVMOptions.cmake | ||
---|---|---|
781 | nit: the case here doesn't match what you actually return (THIN vs thin) | |
838 | I think the old code supports gcc + gold, which require -flto instead of -flto=full. We still need to translate style full to -flto here, which will do the same thing as -flto=full in clang. |
What is "msvc"? (pointer to another doc accepted :))