[clang] [llvm] [LFI][X86] Add X86 LFI target and system instruction rewrites (PR #189569)

Zachary Yedidia via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 01:51:25 PDT 2026


================
@@ -2974,6 +2974,11 @@ bool X86TargetLowering::isEligibleForSiblingCallOpt(
   if (IsCalleeWin64 != IsCallerWin64)
     return false;
 
+  // Do not optimize vararg calls with 6 arguments for LFI since LFI reserves
+  // %r11, meaning there will not be enough registers available.
+  if (Subtarget.isLFI() && ArgLocs.size() > 5)
+    return false;
----------------
zyedidia wrote:

I added a test case in `lfi-sibcall.ll` that demonstrates a case where register allocation fails without this condition. I think the condition could probably be tightened to also check for var-args -- I will double check that tomorrow.

https://github.com/llvm/llvm-project/pull/189569


More information about the cfe-commits mailing list