Hi everyone!
I'm experimenting with LLVM intermediate representation and I've found that IR produced with cargo rustc --release -- --emit=llvm-ir
can not be compiled with llc
from the LLVM 9.0.1 toolset when using rust >=1.45.0
Steps to reproduce:
cargo init --bin hello-world
cd hello-world
echo "1.45.0" > rust-toolchain
cargo rustc --release -- --emit=llvm-ir
/path/to/llvm9/bin/llc target/release/deps/hello_world-*.ll
I'm getting the following error:
/opt/llvm90/bin/llc: error: /opt/llvm90/bin/llc: target/release/deps/hello_world-cc4e086f6fa63c22.ll:99:22: error: expected ')' at end of argument list
define i32 @main(i32 %0, i8** %1) unnamed_addr #4 {
^
When using rust 1.44.0 or below, everything compiles smoothly. I believe that %#
notation in function arguments has been added to LLVM since version 10, but I'm not sure about that.
So, the question is, has rustc dropped support of LLVM 9.0.1 in 1.45.0? I can't find any notice on that though. Or am I doing something wrong?..
If not, can I somehow force rustc to produce IR that is compatible with LLVM 9.0.1?
P.S.
Unfortunately, using LLVM 10 is not an option for my experiments.
Thanks!!