<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">It is automatically refreshed frequently I believe.<div class=""><br class=""></div><div class="">If it is not there tomorrow, we should start being worried :)</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi<br class=""><div><blockquote type="cite" class=""><div class="">On Sep 21, 2016, at 10:57 AM, Teresa Johnson <<a href="mailto:tejohnson@google.com" class="">tejohnson@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Anyone know how to get these changes on <a href="http://clang.llvm.org/docs/" class="">http://clang.llvm.org/docs/</a>? Is that site periodically refreshed or do I need to do something explicit?<div class=""><br class=""></div><div class="">Thanks,</div><div class="">Teresa</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 21, 2016 at 9:57 AM, Teresa Johnson via cfe-commits <span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tejohnson<br class="">
Date: Wed Sep 21 11:57:03 2016<br class="">
New Revision: 282089<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=282089&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-<wbr class="">project?rev=282089&view=rev</a><br class="">
Log:<br class="">
[docs] Add ThinLTO user documentation<br class="">
<br class="">
Summary: Add some user facing documentation on ThinLTO and how to use it.<br class="">
<br class="">
Reviewers: mehdi_amini<br class="">
<br class="">
Subscribers: mehdi_amini, cfe-commits<br class="">
<br class="">
Differential Revision: <a href="https://reviews.llvm.org/D24806" rel="noreferrer" target="_blank" class="">https://reviews.llvm.org/<wbr class="">D24806</a><br class="">
<br class="">
Added:<br class="">
    cfe/trunk/docs/ThinLTO.rst<br class="">
Modified:<br class="">
    cfe/trunk/docs/CommandGuide/<wbr class="">clang.rst<br class="">
    cfe/trunk/docs/index.rst<br class="">
<br class="">
Modified: cfe/trunk/docs/CommandGuide/<wbr class="">clang.rst<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/CommandGuide/clang.rst?rev=282089&r1=282088&r2=282089&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/cfe/trunk/docs/<wbr class="">CommandGuide/clang.rst?rev=<wbr class="">282089&r1=282088&r2=282089&<wbr class="">view=diff</a><br class="">
==============================<wbr class="">==============================<wbr class="">==================<br class="">
--- cfe/trunk/docs/CommandGuide/<wbr class="">clang.rst (original)<br class="">
+++ cfe/trunk/docs/CommandGuide/<wbr class="">clang.rst Wed Sep 21 11:57:03 2016<br class="">
@@ -328,13 +328,19 @@ Code Generation Options<br class="">
   model can be overridden with the tls_model attribute. The compiler will try<br class="">
   to choose a more efficient model if possible.<br class="">
<br class="">
-.. option:: -flto, -emit-llvm<br class="">
+.. option:: -flto[=full,thin], -emit-llvm<br class="">
<br class="">
   Generate output files in LLVM formats, suitable for link time optimization.<br class="">
   When used with :option:`-S` this generates LLVM intermediate language<br class="">
   assembly files, otherwise this generates LLVM bitcode format object files<br class="">
   (which may be passed to the linker depending on the stage selection options).<br class="">
<br class="">
+  The default for :option:`-flto` is :option:`-flto=full`, in which the<br class="">
+  LLVM bitcode is suitable for monolithic Link Time Optimization (LTO), where<br class="">
+  the linker merges all such modules into a single combined module for<br class="">
+  optimization. With :option:`-flto=thin`, :doc:`ThinLTO <../ThinLTO>`<br class="">
+  compilation is invoked instead.<br class="">
+<br class="">
 Driver Options<br class="">
 ~~~~~~~~~~~~~~<br class="">
<br class="">
<br class="">
Added: cfe/trunk/docs/ThinLTO.rst<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ThinLTO.rst?rev=282089&view=auto" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/cfe/trunk/docs/<wbr class="">ThinLTO.rst?rev=282089&view=<wbr class="">auto</a><br class="">
==============================<wbr class="">==============================<wbr class="">==================<br class="">
--- cfe/trunk/docs/ThinLTO.rst (added)<br class="">
+++ cfe/trunk/docs/ThinLTO.rst Wed Sep 21 11:57:03 2016<br class="">
@@ -0,0 +1,157 @@<br class="">
+=======<br class="">
+ThinLTO<br class="">
+=======<br class="">
+<br class="">
+.. contents::<br class="">
+   :local:<br class="">
+<br class="">
+Introduction<br class="">
+============<br class="">
+<br class="">
+*ThinLTO* compilation is a new type of LTO that is both scalable and<br class="">
+incremental. *LTO* (Link Time Optimization) achieves better<br class="">
+runtime performance through whole-program analysis and cross-module<br class="">
+optimization. However, monolithic LTO implements this by merging all<br class="">
+input into a single module, which is not scalable<br class="">
+in time or memory, and also prevents fast incremental compiles.<br class="">
+<br class="">
+In ThinLTO mode, as with regular LTO, clang emits LLVM bitcode after the<br class="">
+compile phase. The ThinLTO bitcode is augmented with a compact summary<br class="">
+of the module. During the link step, only the summaries are read and<br class="">
+merged into a combined summary index, which includes an index of function<br class="">
+locations for later cross-module function importing. Fast and efficient<br class="">
+whole-program analysis is then performed on the combined summary index.<br class="">
+<br class="">
+However, all transformations, including function importing, occur<br class="">
+later when the modules are optimized in fully parallel backends.<br class="">
+By default, linkers_ that support ThinLTO are set up to launch<br class="">
+the ThinLTO backends in threads. So the usage model is not affected<br class="">
+as the distinction between the fast serial thin link step and the backends<br class="">
+is transparent to the user.<br class="">
+<br class="">
+For more information on the ThinLTO design and current performance,<br class="">
+see the LLVM blog post `ThinLTO: Scalable and Incremental LTO<br class="">
+<<a href="http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html" rel="noreferrer" target="_blank" class="">http://blog.llvm.org/2016/<wbr class="">06/thinlto-scalable-and-<wbr class="">incremental-lto.html</a>>`_.<br class="">
+While tuning is still in progress, results in the blog post show that<br class="">
+ThinLTO already performs well compared to LTO, in many cases matching<br class="">
+the performance improvement.<br class="">
+<br class="">
+Current Status<br class="">
+==============<br class="">
+<br class="">
+Clang/LLVM<br class="">
+----------<br class="">
+.. _compiler:<br class="">
+<br class="">
+The 3.9 release of clang includes ThinLTO support. However, ThinLTO<br class="">
+is under active development, and new features, improvements and bugfixes<br class="">
+are being added for the next release. For the latest ThinLTO support,<br class="">
+`build a recent version of clang and LLVM<br class="">
+<<a href="http://llvm.org/docs/CMake.html" rel="noreferrer" target="_blank" class="">http://llvm.org/docs/CMake.<wbr class="">html</a>>`_.<br class="">
+<br class="">
+Linkers<br class="">
+-------<br class="">
+.. _linkers:<br class="">
+.. _linker:<br class="">
+<br class="">
+ThinLTO is currently supported for the following linkers:<br class="">
+<br class="">
+- **gold (via the gold-plugin)**:<br class="">
+  Similar to monolithic LTO, this requires using<br class="">
+  a `gold linker configured with plugins enabled<br class="">
+  <<a href="http://llvm.org/docs/GoldPlugin.html" rel="noreferrer" target="_blank" class="">http://llvm.org/docs/<wbr class="">GoldPlugin.html</a>>`_.<br class="">
+- **ld64**:<br class="">
+  Starting with `Xcode 8 <<a href="https://developer.apple.com/xcode/" rel="noreferrer" target="_blank" class="">https://developer.apple.com/<wbr class="">xcode/</a>>`_.<br class="">
+<br class="">
+Additionally, support is being added to the *lld* linker.<br class="">
+<br class="">
+Usage<br class="">
+=====<br class="">
+<br class="">
+Basic<br class="">
+-----<br class="">
+<br class="">
+To utilize ThinLTO, simply add the -flto=thin option to compile and link. E.g.<br class="">
+<br class="">
+.. code-block:: console<br class="">
+<br class="">
+  % clang -flto=thin -O2 file1.c file2.c -c<br class="">
+  % clang -flto=thin -O2 file1.o file2.o -o a.out<br class="">
+<br class="">
+As mentioned earlier, by default the linkers will launch the ThinLTO backend<br class="">
+threads in parallel, passing the resulting native object files back to the<br class="">
+linker for the final native link.  As such, the usage model the same as<br class="">
+non-LTO.<br class="">
+<br class="">
+With gold, if you see an error during the link of the form:<br class="">
+<br class="">
+.. code-block:: console<br class="">
+<br class="">
+  /usr/bin/ld: error: /path/to/clang/bin/../lib/<wbr class="">LLVMgold.so: could not load plugin library: /path/to/clang/bin/../lib/<wbr class="">LLVMgold.so: cannot open shared object file: No such file or directory<br class="">
+<br class="">
+Then either gold was not configured with plugins enabled, or clang<br class="">
+was not built with ``-DLLVM_BINUTILS_INCDIR`` set properly. See<br class="">
+the instructions for the<br class="">
+`LLVM gold plugin <<a href="http://llvm.org/docs/GoldPlugin.html#how-to-build-it" rel="noreferrer" target="_blank" class="">http://llvm.org/docs/<wbr class="">GoldPlugin.html#how-to-build-<wbr class="">it</a>>`_.<br class="">
+<br class="">
+Controlling Backend Parallelism<br class="">
+-----------------------------<wbr class="">--<br class="">
+.. _parallelism:<br class="">
+<br class="">
+By default, the ThinLTO link step will launch up to<br class="">
+``std::thread::hardware_<wbr class="">concurrency`` number of threads in parallel.<br class="">
+For machines with hyper-threading, this is the total number of<br class="">
+virtual cores. For some applications and machine configurations this<br class="">
+may be too aggressive, in which case the amount of parallelism can<br class="">
+be reduced to ``N`` via:<br class="">
+<br class="">
+- gold:<br class="">
+  ``-Wl,-plugin-opt,jobs=N``<br class="">
+- ld64:<br class="">
+  ``-Wl,-mllvm,-threads=N``<br class="">
+<br class="">
+Incremental<br class="">
+-----------<br class="">
+.. _incremental:<br class="">
+<br class="">
+ThinLTO supports fast incremental builds through the use of a cache,<br class="">
+which currently must be enabled through a linker option.<br class="">
+<br class="">
+- gold (as of LLVM r279883):<br class="">
+  ``-Wl,-plugin-opt,cache-dir=/<wbr class="">path/to/cache``<br class="">
+- ld64 (support in clang 3.9 and Xcode 8):<br class="">
+  ``-Wl,-cache_path_lto,/path/<wbr class="">to/cache``<br class="">
+<br class="">
+Clang Bootstrap<br class="">
+---------------<br class="">
+<br class="">
+To bootstrap clang/LLVM with ThinLTO, follow these steps:<br class="">
+<br class="">
+1. The host compiler_ must be a version of clang that supports ThinLTO.<br class="">
+#. The host linker_ must support ThinLTO (and in the case of gold, must be<br class="">
+   `configured with plugins enabled <<a href="http://llvm.org/docs/GoldPlugin.html" rel="noreferrer" target="_blank" class="">http://llvm.org/docs/<wbr class="">GoldPlugin.html</a>>`_.<br class="">
+#. Use the following additional `CMake variables<br class="">
+   <<a href="http://llvm.org/docs/CMake.html#options-and-variables" rel="noreferrer" target="_blank" class="">http://llvm.org/docs/CMake.<wbr class="">html#options-and-variables</a>>`_<br class="">
+   when configuring the bootstrap compiler build:<br class="">
+<br class="">
+  * ``-DLLVM_ENABLE_LTO=Thin``<br class="">
+  * ``-DLLVM_PARALLEL_LINK_JOBS=1`<wbr class="">`<br class="">
+    (since the ThinLTO link invokes parallel backend jobs)<br class="">
+  * ``-DCMAKE_C_COMPILER=/path/to/<wbr class="">host/clang``<br class="">
+  * ``-DCMAKE_CXX_COMPILER=/path/<wbr class="">to/host/clang++``<br class="">
+  * ``-DCMAKE_RANLIB=/path/to/<wbr class="">host/llvm-ranlib``<br class="">
+  * ``-DCMAKE_AR=/path/to/host/<wbr class="">llvm-nm``<br class="">
+<br class="">
+#. To use additional linker arguments for controlling the backend<br class="">
+   parallelism_ or enabling incremental_ builds of the bootstrap compiler,<br class="">
+   after configuring the build, modify the resulting CMakeCache.txt file in the<br class="">
+   build directory. Specify any additional linker options after<br class="">
+   ``CMAKE_EXE_LINKER_FLAGS:<wbr class="">STRING=``. Note the configure may fail if<br class="">
+   linker plugin options are instead specified directly in the previous step.<br class="">
+<br class="">
+More Information<br class="">
+================<br class="">
+<br class="">
+* From LLVM project blog:<br class="">
+  `ThinLTO: Scalable and Incremental LTO<br class="">
+  <<a href="http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html" rel="noreferrer" target="_blank" class="">http://blog.llvm.org/2016/06/<wbr class="">thinlto-scalable-and-<wbr class="">incremental-lto.html</a>>`_<br class="">
<br class="">
Modified: cfe/trunk/docs/index.rst<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/index.rst?rev=282089&r1=282088&r2=282089&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/cfe/trunk/docs/index.<wbr class="">rst?rev=282089&r1=282088&r2=<wbr class="">282089&view=diff</a><br class="">
==============================<wbr class="">==============================<wbr class="">==================<br class="">
--- cfe/trunk/docs/index.rst (original)<br class="">
+++ cfe/trunk/docs/index.rst Wed Sep 21 11:57:03 2016<br class="">
@@ -37,6 +37,7 @@ Using Clang as a Compiler<br class="">
    SourceBasedCodeCoverage<br class="">
    Modules<br class="">
    MSVCCompatibility<br class="">
+   ThinLTO<br class="">
    CommandGuide/index<br class="">
    FAQ<br class="">
<br class="">
<br class="">
<br class="">
______________________________<wbr class="">_________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div class="gmail_signature" data-smartmail="gmail_signature"><span style="font-family: Times; font-size: inherit;" class=""><table cellspacing="0" cellpadding="0" class=""><tbody class=""><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small" class=""><td nowrap="" style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px" class="">Teresa Johnson |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px" class=""> Software Engineer |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px" class=""> <a href="mailto:tejohnson@google.com" target="_blank" class="">tejohnson@google.com</a> |</td><td nowrap="" style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px" class=""> 408-460-2413</td></tr></tbody></table></span></div>
</div>
</div></blockquote></div><br class=""></div></body></html>