[PATCH] D30239: enable -flto=thin, -flto-jobs=, and -fthinlto-index= in clang-cl

Hans Wennborg via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 22 11:36:47 PST 2017


hans added a comment.

In https://reviews.llvm.org/D30239#683697, @inglorion wrote:

> @mehdi_amini:
>
> > Is clang-cl using lld as default? How is the switch done? Ideally we should have a nice error message from the driver if -flto is used without lld.
>
> I believe we use link.exe by default. You can use lld by passing -fuse-ld=lld to the compiler.
>
> I can add an error message when -flto is used without -fuse-ld=lld at least for the case when linking is actually performed. Of course, it's possible to invoke clang-cl without it doing any linking. If you're only compiling, it's perfectly valid to use -flto without -fuse-ld=lld.


That sounds like a good idea.



================
Comment at: test/Driver/cl-lto.c:2
+// -flto causes a switch to llvm-bc object files.
+// RUN: %clang_cl -ccc-print-phases -c -flto -- %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-COMPILE-ACTIONS < %t %s
----------------
This test and the other file look like they're doing the same as test/Driver/(thin)lto.c.

I don't think we need to test these separately for clang-cl; it should be enough with a simple test in test/Driver/cl-options.c to check that they're exposed and that -### looks right for them.


https://reviews.llvm.org/D30239





More information about the cfe-commits mailing list