Basic arguments

  1. Generate IR

clang -emit-llvm -S xx.cpp

  1. Generate bitcode (*.bc)

clang -emit-llvm -o xx.bc xx.cpp

  1. Load pass (optimization)

opt -load libxx.so -xx < xx.bc > /dev/null

  1. Load pass (with Clang)

Clang ++ -Xclang -load -Xclang *.so xx.cpp