Hello Expert
In Writing an LLVM Pass,(Writing an LLVM Pass — LLVM 18.0.0git documentation) I checked [Running a pass with opt
].
In Eaxmple,
cat /tmp/a.ll
define i32 @foo() {
a = add i32 2, 3
ret i32 %a
}
define void @bar() {
ret void
}
.ll file is only that.
“I created a .c file, then used clang -emit-llvm -S test.c
to generate a .ll file. After that, I tried build/bin/opt -disable-output /tmp/a.ll -passes=helloworld
using the basic example from helloworld.cpp, but nothing was printed, and neither function names like ‘foo’ nor ‘main’ were displayed. Could you explain why this is happening? It seems that it might be because the .ll file contains more than just function definitions, such as DataLayout or FileName. In fact, when I have a .ll file that contains only function definitions with ‘define …,’ the function names are displayed correctly. Can you clarify this?”
I hope this helps clarify your question, and I’m here to assist with any further information or explanations you may need.