Skip to content

Latest commit

 

History

History
39 lines (33 loc) · 1.08 KB

README.md

File metadata and controls

39 lines (33 loc) · 1.08 KB

llvm-block

llvm-block catches identical basic blocks between two modules.
Since llvm-block draws on debug info, input modules should be generated with -g option.

Prerequisites

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh <version number>
  • clang 10

Build

git clone https://github.com/kc-ml2/llvm-block.git
cd llvm-block && mkdir build && cd build
cmake .. -DLLVM_ROOT=<path to llvm source root>
make llvm-block
./llvm-block/llvm-block <before> <after>

Quick Commands

clang -O0 -g -Xclang -disable-O0-optnone -emit-llvm -S *.c
llvm-link *.ll -S -o beforeg.ll
opt beforeg.ll -S <transform pass> -o afterg.ll

<path to llvm-block>/llvm-block beforeg.ll afterg.ll 2> output

opt —strip-debug -S beforeg.ll -o before.ll
opt —strip-debug -S afterg.ll -o after.ll

mkdir before after
opt -dot-cfg before.ll
mv .*.dot before
opt -dot-cfg after.ll
mv .*.dot after