<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=""><div class="">cat hello.ll</div><div class=""><br class=""></div><div class=""><div class="">; ModuleID = 'hello.c'</div><div class="">source_filename = "hello.c"</div><div class="">target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"</div><div class="">target triple = "x86_64-unknown-linux-gnu"</div><div class=""><br class=""></div><div class="">; Function Attrs: noinline nounwind optnone uwtable</div><div class="">define dso_local i32 @foo() #0 {</div><div class="">entry:</div><div class="">  %a = alloca i32, align 4</div><div class="">  store i32 1, i32* %a, align 4</div><div class="">  %0 = load i32, i32* %a, align 4</div><div class="">  ret i32 %0</div><div class="">}</div><div class=""><br class=""></div><div class="">attributes #0 = { noinline nounwind optnone uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }</div><div class=""><br class=""></div><div class="">!llvm.module.flags = !{!0}</div><div class="">!llvm.ident = !{!1}</div><div class=""><br class=""></div><div class="">!0 = !{i32 1, !"wchar_size", i32 4}</div><div class="">!1 = !{!"clang version 13.0.0 (<a href="https://github.com/llvm/llvm-project.git" class="">https://github.com/llvm/llvm-project.git</a> 16e7973c5d8fb543ea9e91735be8610a8b1c262a)”}</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">$BUILD_DIR/bin/opt -disable-output hello.ll -passes=helloworld</div><div class=""><br class=""></div><div class="">*nothing gets printed*</div><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 10, 2021, at 3:23 PM, Arthur Eubanks <<a href="mailto:aeubanks@google.com" class="">aeubanks@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div dir="ltr" class="">Can you post the .ll file that doesn't work and the command you ran?</div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 10, 2021 at 3:21 PM Joshua R Hilke <<a href="mailto:jrhilke@mit.edu" class="">jrhilke@mit.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class="">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?<div class=""><br class=""><div class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Feb 10, 2021, at 2:11 PM, Arthur Eubanks <<a href="mailto:aeubanks@google.com" target="_blank" class="">aeubanks@google.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">That's due to the recent transition to the new pass manager. Adding -enable-new-pm=0 to the opt command should work.<div class=""><br class=""></div><div class="">I'll update the documentation to explicitly say that the legacy pass manager is no longer the default in big red letters.</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 10, 2021 at 1:49 PM Joshua R Hilke via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="">I’m just trying to run the hello world example from the LLVM Writing a Pass Tutorial (<a href="https://llvm.org/docs/WritingAnLLVMPass.html" target="_blank" class="">https://llvm.org/docs/WritingAnLLVMPass.html</a>), but whenever I run:<div class=""><br class=""></div><div class="">$BUILD_DIR/bin/clang -c -emit-llvm hello.c<br class=""><div class=""><br class=""></div><div class="">$BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so -hello < hello.bc > /dev/null</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I get the following error:</div><div class=""><br class=""></div><div class="">bin/opt: unknown pass name ‘hello’</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Which seems odd because if I run:</div><div class=""><br class=""></div><div class="">$BUILD_DIR/bin/opt -load $BUILD_DIR/lib/LLVMHello.so --help | grep hello</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I get:</div><div class=""><br class=""></div><div class="">--hello <span style="white-space:pre-wrap" class="">            </span>- Hello World Pass</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">To build LLVM I’m running the following commands from my build directory:</div><div class=""><br class=""></div><div class="">cmake -G Ninja -DLLVM_ENABLE_PROJECTS=‘clang’ ../llvm</div><div class=""><br class=""></div><div class="">cmake --build . </div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Just to clarify, I’m not writing my own pass. Just trying to run the ‘hello’ pass that comes default when building LLVM</div><div class=""><br class=""></div></div></div>_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></div></blockquote></div>
</div></blockquote></div><br class=""></div></body></html>