Aim of the Program Optimization Lab 2018 is to explore the LLVM opt tool and extend it with an advanced Value-Set Analysis according to Reps et al..
A PDF version of the presentation we gave at the end of the course is available here.
- Julian Erhard
- Jakob Gottfriedsen
- Peter Munch
- Alexander Roschlaub
- Michael B. Schwarz
Clone the project into the following folder:
cd llvm/lib/Transforms
git clone [email protected]:peterrum/po-lab-2018.git
mv po-lab-2018 ValueSetAnalysis
and add the following line to the CMakeLists.txt
-file:
add_subdirectory(ValueSetAnalysis)
add_subdirectory(ValueSetAnalysis/tutorial)
add_subdirectory(ValueSetAnalysis/benchmark)
Finally run make
and/or make install
again.
Recompile and view output with your favorite text editor:
clang -Os -S -emit-llvm hello.c -o hello.ll
In the case you have already a .bc-file run the following to get the .ll-file:
llvm-dis hello-opt.bc
clang -Os -S -emit-llvm hello.c -o hello.ll
clang -O3 -emit-llvm hello.c -c -o hello.bc
opt -load llvm/lib/llvm-vsa.so -vsapass < hello.bc > /dev/null
clang -O0 -emit-llvm hello.c -Xclang -disable-O0-optnone -c -o hello.bc
opt -mem2reg < hello.bc > hello-opt.bc
opt -load llvm/lib/llvm-vsa.so -vsapass < hello.bc > /dev/null
- Write output: errs() << "Hello World!\n"
- Iterator over all functions
- Iterator over all basic blocks
- getName()
- Iterator over all instructions
- getOpcodeName()
- getValueID()
- users()
- V visit(...)
- Arbitrary precision integer