[PATCH] D71387: pass -mabi to LTO linker only in RISC-V targets, enable RISC-V LTO

Kuan Hsu Chen (Zakk) via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 18:43:50 PST 2019


khchen added a comment.

In D71387#1790413 <https://reviews.llvm.org/D71387#1790413>, @efriedma wrote:

> > But in RISCV clang emits the same IR for different ABI (-mabi),
>
> This is not true.  For simple cases, it does, yes, but there are some weird edge cases for functions with many arguments.


It's interesting, I didn't find the edge cases for functions with many arguments.
but you are right, I found a case when passing struct as argument, 
different `-mabi` will generate incompatible function interface.

  struct bar{
  int a;
  float b;
  };
  
  float foo(struct bar a, struct bar b){ ...}

compiled with `-march=rv32imafc -mabi=ilp32f`: `define dso_local float @foo(i32 %0, float %1, i32 %2, float %3)`
compiled with `-march=rv32imafc -mabi=-ilp32`: `define dso_local float @foo([2 x i32] %a.coerce, [2 x i32] %b.coerce) `

@efriedma thanks for your suggestions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71387





More information about the cfe-commits mailing list