[PATCH] D101718: [X86] Fold load with tail call more aggressively

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 1 18:05:44 PDT 2023


pengfei accepted this revision.
pengfei added a comment.
This revision is now accepted and ready to land.

LGTM. Let me know if you need help for committing the patch.



================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1209
         continue;
+      if (N->getOpcode() == X86ISD::TC_RETURN) {
+        // The TC_RETURN instructions execute after the epilog, so they
----------------
mejedi wrote:
> This part I'm least happy about. It was copied verbatim from X86InstrCompiler.td (X86tcret_6regs).
> 
> TBH, I don't fully understand the implications of moving LOAD close to TC_RETURN. It looks safe. However, if this check is omitted, we can end up moving the LOAD and not folding it. This is causing malformed DAG during scheduling in test/CodeGen/X86/musttail-varargs.ll, can't figure why.
LOAD folding requires 2 scratch registers in some cases. If the 6 parameter registers are occupied, there's only one scratch register available.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101718



More information about the llvm-commits mailing list