That's due to the recent transition to the new pass manager. Adding -enable-new-pm=0 to the opt command should work. I'll update the documentation to explicitly say that the legacy pass manager is no longer the default in big red letters. On Wed, Feb 10, 2021 at 1:49 PM Joshua R Hilke via llvm-dev < llvm-dev at lists.llvm.org> wrote:> I’m just trying to run the hello world example from the LLVM Writing a > Pass Tutorial (https://llvm.org/docs/WritingAnLLVMPass.html), but > whenever I run: > > $BUILD_DIR/bin/clang -c -emit-llvm hello.c > > $BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so -hello < hello.bc > > /dev/null > > > > I get the following error: > > bin/opt: unknown pass name ‘hello’ > > > > Which seems odd because if I run: > > $BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so --help | grep hello > > > I get: > > --hello - Hello World Pass > > > To build LLVM I’m running the following commands from my build directory: > > cmake -G Ninja -DLLVM_ENABLE_PROJECTS=‘clang’ ../llvm > > cmake --build . > > > Just to clarify, I’m not writing my own pass. Just trying to run the > ‘hello’ pass that comes default when building LLVM > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210210/3a47b528/attachment.html>
https://llvm.org/docs/WritingAnLLVMPass.html is mostly about the legacy pass manager. A big revamp is needed to make it new PM ready:) On Wed, Feb 10, 2021 at 2:12 PM Arthur Eubanks via llvm-dev <llvm-dev at lists.llvm.org> wrote:> > That's due to the recent transition to the new pass manager. Adding -enable-new-pm=0 to the opt command should work. > > I'll update the documentation to explicitly say that the legacy pass manager is no longer the default in big red letters. > > On Wed, Feb 10, 2021 at 1:49 PM Joshua R Hilke via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> I’m just trying to run the hello world example from the LLVM Writing a Pass Tutorial (https://llvm.org/docs/WritingAnLLVMPass.html), but whenever I run: >> >> $BUILD_DIR/bin/clang -c -emit-llvm hello.c >> >> $BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so -hello < hello.bc > /dev/null >> >> >> >> I get the following error: >> >> bin/opt: unknown pass name ‘hello’ >> >> >> >> Which seems odd because if I run: >> >> $BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so --help | grep hello >> >> >> I get: >> >> --hello - Hello World Pass >> >> >> To build LLVM I’m running the following commands from my build directory: >> >> cmake -G Ninja -DLLVM_ENABLE_PROJECTS=‘clang’ ../llvm >> >> cmake --build . >> >> >> Just to clarify, I’m not writing my own pass. Just trying to run the ‘hello’ pass that comes default when building LLVM >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- 宋方睿
Got it. Thank you. I tried using the new pass manager from the new tutorial as well but was having an issue where the ‘helloworld’ pass would only work if I manually removed all the metadata from my hello.ll file to where the only thing in it was the function. Otherwise, it would run silently and not print out any function names. Any solution to that?> On Feb 10, 2021, at 2:11 PM, Arthur Eubanks <aeubanks at google.com> wrote: > > That's due to the recent transition to the new pass manager. Adding -enable-new-pm=0 to the opt command should work. > > I'll update the documentation to explicitly say that the legacy pass manager is no longer the default in big red letters. > > On Wed, Feb 10, 2021 at 1:49 PM Joshua R Hilke via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > I’m just trying to run the hello world example from the LLVM Writing a Pass Tutorial (https://llvm.org/docs/WritingAnLLVMPass.html <https://llvm.org/docs/WritingAnLLVMPass.html>), but whenever I run: > > $BUILD_DIR/bin/clang -c -emit-llvm hello.c > > $BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so -hello < hello.bc > /dev/null > > > > I get the following error: > > bin/opt: unknown pass name ‘hello’ > > > > Which seems odd because if I run: > > $BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so --help | grep hello > > > I get: > > --hello - Hello World Pass > > > To build LLVM I’m running the following commands from my build directory: > > cmake -G Ninja -DLLVM_ENABLE_PROJECTS=‘clang’ ../llvm > > cmake --build . > > > Just to clarify, I’m not writing my own pass. Just trying to run the ‘hello’ pass that comes default when building LLVM > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210210/fb3bec06/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1846 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210210/fb3bec06/attachment.bin>