[PATCH] D131263: [RISCV] Do tail call when parameters are passed by stack

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 02:41:48 PDT 2022


luismarques added a comment.

I haven't noticed any specific issue so far but these things are fiddly, the patch needs more eye balls.
See if you can think of additional test coverage scenarios that might be relevant. Does this handle, say, when part of a value is passed on a register and part on the stack?

(OT: I just noticed that Phabricator is not syntax highlighting `RISCVISelLowering.cpp`. Is it because it's too big?)



================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:11278
+  if (LoadSDNode *Ld = dyn_cast<LoadSDNode>(Arg)) {
+    if (Flags.isByVal())
+      // ByVal argument is passed in as a pointer but it's now being
----------------
Is this for sure the only problematic flag? Having more test coverage of weird scenarios would help.


================
Comment at: llvm/test/CodeGen/RISCV/tail-calls.ll:116
 
-; Do not tail call optimize if stack is used to pass parameters.
 declare i32 @callee_args(i32 %a, i32 %b, i32 %c, i32 %dd, i32 %e, i32 %ff, i32 %g, i32 %h, i32 %i, i32 %j, i32 %k, i32 %l, i32 %m, i32 %n)
----------------
Nit: keep the comment but update it to explain that tail call optimization is possible if the stack layout is compatible


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131263



More information about the llvm-commits mailing list