<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi list,<div class=""><br class=""></div><div class="">I have several questions about LLVM pass.</div><div class=""><br class=""></div><div class="">1) Is building a custom LLVM pass out-of-source not recommended?</div><div class="">The official document only contains instructions about in-source build (<a href="http://llvm.org/docs/WritingAnLLVMPass.html" class="">http://llvm.org/docs/WritingAnLLVMPass.html</a>).</div><div class=""><br class=""></div><div class="">2) opt (ver >= 4) with custom pass libraries does not work as before. When I have a simple custom LLVM pass called “helloworld", loading the library works well with 3.9 but opt-4.0 cannot not find the pass:</div><div class=""><br class=""></div><div class=""><div class="">$ opt-3.9 -load ../build/hello/LLVMHelloWorld.so -helloworld hello.bc -S > /dev/null</div><div class="">Hello: main</div><div class=""><br class=""></div><div class="">$ opt-4.0 -load ../build/hello/LLVMHelloWorld.so -helloworld hello.bc -S > /dev/null</div><div class="">opt-4.0: Unknown command line argument '-helloworld'. Try: 'opt-4.0 -help'</div><div class="">opt-4.0: Did you mean '-loops’?</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">3) I tried to invoke custom LLVM passes from clang rather than opt. I followed instructions from several articles like</div><div class=""><a href="https://www.cs.cornell.edu/~asampson/blog/llvm.html" class="">https://www.cs.cornell.edu/~asampson/blog/llvm.html</a></div><div class=""><a href="https://medium.com/@mshockwave/writing-llvm-pass-in-2018-part-iii-d44cd0c2c354" class="">https://medium.com/@mshockwave/writing-llvm-pass-in-2018-part-iii-d44cd0c2c354</a></div><div class="">and registered the pass to clang’s workflow with legacy pass manger. But it raises segmentation fault errors.</div><div class="">What is a recommended way to register custom passes to clang directly?</div><div class=""><br class=""></div><div class="">Thanks in advance.</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Kihong</div></body></html>