Sign inSign up

prodrelworks/llvm29

By prodrelworks

Updated about 5 years ago

Image
0

250

prodrelworks/llvm29 repository overview

LLVM-2.9

Clone and run this container for LLVM 2.9 clang & opt tools

Install.

This docker maps the llvm-2.9 src (directory to where LLVM 2.9 is unzipped) to a internal folder /projects/llvm-2.9 inside the docker image.

docker run --name llvm29 -it -v $PWD:/projects prodrelworks/llvm29:latest , $PWD contains the llvm-2.9 src.

LLVM-2.9 src

Instructions

Start with some C file say code.c with valid C code. Check the build.sh file for more details.

$ clang+llvm-2.9-x86_64-linux.tar/bin/opt --help | grep "insert"
$ clang+llvm-2.9-x86_64-linux.tar/bin/clang -c -emit-llvm code.c -o code.bc

# Human Readable format
$ clang+llvm-2.9-x86_64-linux.tar/bin/clang -S -emit-llvm code.c -o code.ll
$ clang+llvm-2.9-x86_64-linux.tar/bin/opt -insert-path-profiling -S code.ll -o code.mod.ll 
$ cat code.mod.ll
# Profile Infomation.

clang-2.9/bin/clang -emit-llvm -o code.main.bc -c code.c
clang-2.9/bin/opt -insert-path-profiling code.main.bc -o code.profile.bc
clang-2.9/bin/llc -relocation-model=pic code.profile.bc -o code.profile.s

g++ -o code.profile code.profile.s clang-2.9/lib/profile_rt.so
./code.profile

clang-2.9/bin/opt -f -path-profile-loader -path-profile-verifier -profile-info-file=llvmprof.out code.main.bc
clang-2.9/bin/llvm-prof -A code.profile.bc edgefrompath.llvmprof.out

opt --profile-file=llvmprof.out code.main.bc
cmp edgefrompath.llvmprof.out llvmprof.out

Use -v to map llvm-2.9 install dir to /projects.

# Build LLVM changes
opt -load /usr/local/lib/LLVMHotPaths.so -f -path-profile-loader -profile-info-file=llvmprof.out -dump_hot_paths code.main.bc 

# LLVM Build
cd /projects/llvm-2.9/build
make -j 8
make install 
cd ../../../
# Link with HotPaths Pass (WIP)
opt -load /usr/local/lib/LLVMHotPaths.so -f -path-profile-loader -profile-info-file=llvmprof.out -dump_hot_paths code.main.bc 

...
Execution Counts : -1.000000e+00 
Execution Counts : -2.000000e+00 
Execution Counts : -3.000000e+00 
Execution Counts : -4.000000e+00 
Execution Counts : -5.000000e+00 
Execution Counts : -6.000000e+00 
Execution Counts : -7.000000e+00 
Execution Counts : -8.000000e+00 
Execution Counts : -9.000000e+00 
Execution Counts : -1.000000e+01 
Execution Counts : -1.100000e+01 
Execution Counts : -1.200000e+01 
Execution Counts : -1.300000e+01 
Execution Counts : -1.400000e+01 
...

Tag summary

Content type

Image

Digest

Size

858.7 MB

Last updated

about 5 years ago

docker pull prodrelworks/llvm29