[all-commits] [llvm/llvm-project] 7bf2d5: [x86] Enable indirect tail calls with more argumen...

Hans Wennborg via All-commits all-commits at lists.llvm.org
Mon Feb 16 00:25:20 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7bf2d5f14b2cd0a26f4779673dd8c51b46dea095
      https://github.com/llvm/llvm-project/commit/7bf2d5f14b2cd0a26f4779673dd8c51b46dea095
  Author: Hans Wennborg <hans at hanshq.net>
  Date:   2026-02-16 (Mon, 16 Feb 2026)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
    M llvm/lib/Target/X86/X86InstrCompiler.td
    M llvm/lib/Target/X86/X86InstrFragments.td
    A llvm/test/CodeGen/X86/fold-call-4.ll
    M llvm/test/CodeGen/X86/fold-call.ll
    A llvm/test/CodeGen/X86/tailcall-mem_enoughregs.ll

  Log Message:
  -----------
  [x86] Enable indirect tail calls with more arguments (#137643)

X86ISelDAGToDAG's `isCalleeLoad` / `moveBelowOrigChain` tries to move
the load instruction next to the call so they can be folded, but it
would only allow a single CopyToReg node in between.

This patch makes it look through multiple CopyToReg, while being careful
to only perform the transformation when the load+call can be folded.

As part of that, it also replaces the `X86tcret_1reg` and `X86tcret_6regs`,
which checks that there are enough free registers to compute the call
address, with a more correct `X86tcret_enough_regs` that the
`moveBelowOrigChain` is also gated on.

Fixes #136848



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list