X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLinkTimeOptimization.rst;h=c15abd325ed03c989cd9bddf887fcc77dbe76155;hb=5be77762a3aa434ee877b0a03b98b5c3a7571918;hp=53d673e406667c33478ae586fed5ef158002987f;hpb=a3a2eb08e1a2ab8e8138be05f9b03fc8f0d46fc0;p=oota-llvm.git diff --git a/docs/LinkTimeOptimization.rst b/docs/LinkTimeOptimization.rst index 53d673e4066..c15abd325ed 100644 --- a/docs/LinkTimeOptimization.rst +++ b/docs/LinkTimeOptimization.rst @@ -1,5 +1,3 @@ -.. _lto: - ====================================================== LLVM Link Time Optimization: Design and Implementation ====================================================== @@ -29,6 +27,8 @@ bitcode files. This tight integration between the linker and LLVM optimizer helps to do optimizations that are not possible in other models. The linker input allows the optimizer to avoid relying on conservative escape analysis. +.. _libLTO-example: + Example of link time optimization --------------------------------- @@ -83,9 +83,10 @@ invokes system linker. return foo1(); } -.. code-block:: bash +To compile, run: + +.. code-block:: console - --- command lines --- % clang -emit-llvm -c a.c -o a.o # <-- a.o is LLVM bitcode file % clang -c main.c -o main.o # <-- main.o is native object file % clang a.o main.o -o main # <-- standard link command without modifications @@ -94,7 +95,7 @@ invokes system linker. visible symbol defined in LLVM bitcode file. The linker completes its usual symbol resolution pass and finds that ``foo2()`` is not used anywhere. This information is used by the LLVM optimizer and it - removes ``foo2()``. + removes ``foo2()``. * As soon as ``foo2()`` is removed, the optimizer recognizes that condition ``i < 0`` is always false, which means ``foo3()`` is never used. Hence, the