[PATCH] D102925: [RISCV] Add wrong arch attribute objfile test.

Zakk Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 22 09:03:03 PDT 2021


khchen added a comment.

I got the similar IR during LTO because the clang driver would not pass the -mattr option to lto code generator.

example:

  $(clang) -target riscv64-unknown-linux-gnu -flto -O3 gmain.cpp.o -c main.cpp
  $(clang) -target riscv64-unknown-linux-gnu -flto -O3 gmain.cpp.o -o Builtins

In addition, backend will adjust the target-features according to function attribute [1][2], 
it means the generated function would have +a,+c,+d,+f,+m instructions,
Why do you think the arch value in object file should still be `rv64i2p0`?

[1] https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp#L76
[2] https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp#L172


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102925/new/

https://reviews.llvm.org/D102925



More information about the llvm-commits mailing list