[PATCH] D102852: [RISCV] Fix a crash when lowering split float arguments

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 20 08:17:42 PDT 2021


luismarques added a comment.

In D102852#2824822 <https://reviews.llvm.org/D102852#2824822>, @frasercrmck wrote:

> Thanks for taking a look.

Thanks for the detailed feedback! That helps me a lot, as I can better understand where you're coming from :)

> To quickly address the second part, I was a bit presumptuous. I was observing the above, e.g. the `<32 x float> being split into:
>
>   ; CHECK-NEXT:    fmv.w.x fa0, a0
>   ; CHECK-NEXT:    fmv.w.x fa1, a1
>   ; CHECK-NEXT:    fmv.w.x fa2, a2
>   ; CHECK-NEXT:    fmv.w.x fa3, a3
>   ; CHECK-NEXT:    fmv.w.x fa4, a4
>   ; CHECK-NEXT:    flw ft0, 64(sp)
>   ; CHECK-NEXT:    flw ft1, 68(sp)
>   ...
>
> We (may) never access `0-63(sp)` so to a casual observer it seems wasteful to use the stack for those parts of the split value that go into registers `a0-a4`. But thinking about it further I now know (believe) that this is required in case the function takes the address of its argument. There needs to be a "full" copy of the argument somewhere in memory. I believe I would edit that out of the summary now.

Sorry if I'm misunderstanding your point, but we *are* accessing `0-63(sp)` (later below). Am I reading the assembly totally wrong or does it seem to be spilling the original values of the floating-point callee-saved registers *after* killing their old values (by loading into them some of the arguments passed on the stack, as part of preparing the fastcc call), and never restoring them?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102852



More information about the llvm-commits mailing list