How to disable optimization in LLVM

I am compiling code with clang with -O4 optimization. However, I want to disable feature inlining. I have my own LLVM pass that injects some code into the generated code. After my walk, I want to enable feature nesting. How can i do this.

+6
source share
2 answers

You can use opt, which says it can run passes in any order.

 clang -c main.cpp -O0 -emit-llvm | opt -load yourplugin -yourpass -inline 
+6
source

If you hack clang, you can change the order in the file clang/lib/CodeGen/BackendUtil.cpp . You must insert your pass before embedding in the CreatePasses() method.

+4
source

Source: https://habr.com/ru/post/921800/


All Articles