[Error] Converting LLVM IR to RISC-V Assembly

Hi, I want to convert the LLVM IR generated from tensorflow XLA to RISC-V assembly. I have successfully generated file_name.ll from XLA but it causing issue when I tried to convert it RISCV assembly (conversion to x86 causes no trouble). I am using latest version of llvm and also it has support for riscv (i verified it using llc -march=riscv64 -mattr=help). I tried with different combination of llc flags but each time i am getting this error,

llc: error: llc: ir-with-opt.ll:7:131: error: expected type
define void @a_inference_model_fn_20__XlaMustCompile_true_config_proto_1223674454347519703_executor_type_11160318154034397263_.27(ptr nocapture readnone %retval, ptr noalias nocapture readnone %run_options, ptr noalias nocapture readnone %params, ptr noalias nocapture readonly %buffer_table, ptr noalias nocapture readnone %status, ptr noalias nocapture readnone %prof_counters) local_unnamed_addr #0 {

And some command I used are (each have same error),

  1. llc ir-with-opt.ll -march=riscv64;
  2. llc -mtriple riscv64 -target-abi lp64d -mattr=+m,+d,+experimental-v ir-with-opt.ll --filetype=obj

If anyone has any idea about this please share your thoughts. If you need any other information feel free to ask me. Thank you!

131 is pointing at the first ptr. Are you sure you’re using a relatively recent llc that understands opaque pointers?

1 Like

Thank you for your reply, yes that was the issue I did not notice that I have the old version of llvm in my path and I also got the current version 16 which was built with MLIR, with specified target for x86, amd, and em64t. That’s why both of them did not working with the IR for riscv but work for x86. Thank you again for response and sorry for negligence.