[PATCH] D30240: enable building with LTO on Windows using clang-cl and lld

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 11:46:56 PST 2017


hans added a comment.

This is cool! Does the lto/thinlto build actually work, tests passing etc?



================
Comment at: cmake/modules/HandleLLVMOptions.cmake:416
+    # or using LTO (/Brepro with LTO would result in a warning about the flag
+    # being unused, because we're not generating object files).
     # This checks CMAKE_CXX_COMPILER_ID in addition to check_cxx_compiler_flag()
----------------
Maybe we should just make `/Brepro` be ignored with `-flto` in clang-cl instead of making users remove the flag?


================
Comment at: cmake/modules/HandleLLVMOptions.cmake:707
+  if(NOT CMAKE_LINKER MATCHES "link.exe$")
+    append("-flto=thin" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+  endif()
----------------
Does this mean that if the user sets `LLVM_ENABLE_LTO` but forgets to set the build to use lld, we silently don't do LTO? Maybe we should error in the non-lld case instead?


https://reviews.llvm.org/D30240





More information about the llvm-commits mailing list