diff --git a/docs/LinkTimeOptimization.html b/docs/LinkTimeOptimization.html
index b3bc4814fdc..52ab119707c 100644
--- a/docs/LinkTimeOptimization.html
+++ b/docs/LinkTimeOptimization.html
@@ -79,7 +79,7 @@ conservative escape analysis.
The following example illustrates the advantages of LTO's integrated
approach and clean interface. This example requires a system linker which
supports LTO through the interface described in this document. Here,
- llvm-gcc transparently invokes system linker.
+ clang transparently invokes system linker.
- Input source file a.c is compiled into LLVM bitcode form.
- Input source file main.c is compiled into native object code.
@@ -89,27 +89,29 @@ conservative escape analysis.
extern int foo1(void);
extern void foo2(void);
extern void foo4(void);
+
--- a.c ---
#include "a.h"
static signed int i = 0;
void foo2(void) {
- i = -1;
+ i = -1;
}
static int foo3() {
-foo4();
-return 10;
+ foo4();
+ return 10;
}
int foo1(void) {
-int data = 0;
+ int data = 0;
-if (i < 0) { data = foo3(); }
+ if (i < 0)
+ data = foo3();
-data = data + 42;
-return data;
+ data = data + 42;
+ return data;
}
--- main.c ---
@@ -117,30 +119,35 @@ return data;
#include "a.h"
void foo4(void) {
- printf ("Hi\n");
+ printf("Hi\n");
}
int main() {
- return foo1();
+ return foo1();
}
--- command lines ---
-$ llvm-gcc --emit-llvm -c a.c -o a.o # <-- a.o is LLVM bitcode file
-$ llvm-gcc -c main.c -o main.o # <-- main.o is native object file
-$ llvm-gcc a.o main.o -o main # <-- standard link command without any modifications
+$ 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 any modifications
-
In this example, the linker recognizes that foo2() is an
- externally 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(). As soon as
- foo2() is removed, the optimizer recognizes that condition
- i < 0 is always false, which means foo3() is never
- used. Hence, the optimizer removes foo3(), also. And this in turn,
- enables linker to remove foo4(). This example illustrates the
- advantage of tight integration with the linker. Here, the optimizer can not
- remove foo3() without the linker's input.
-
+
+
+ - In this example, the linker recognizes that foo2() is an
+ externally 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().
+ - As soon as foo2() is removed, the optimizer recognizes that condition
+ i < 0 is always false, which means foo3() is never
+ used. Hence, the optimizer also removes foo3().
+ - And this in turn, enables linker to remove foo4().
+
+
+This example illustrates the advantage of tight integration with the
+ linker. Here, the optimizer can not remove foo3() without the
+ linker's input.
+