我该如何进行llvm链接时间优化

pyt*_*nic 4 c++ llvm clang

我编译了一个C++程序,例如使用以下内容.

clang++ -O4 -emit-llvm file1.cpp -c -o file1.bc 
clang++ -O4 -emit-llvm file2.cpp -c -o file2.bc 

llvm-link file1.bc file2.bc 
Run Code Online (Sandbox Code Playgroud)

如何在此处执行链接时间优化?

Chr*_*odd 9

用途opt:

clang++ -O4 -emit-llvm file1.cpp -c -o file1.bc 
clang++ -O4 -emit-llvm file2.cpp -c -o file2.bc 
llvm-link file1.bc file2.bc -o all.bc
opt -std-compile-opts -std-link-opts -O3 all.bc -o optimized.bc
Run Code Online (Sandbox Code Playgroud)