[llvm] x86: fix musttail sibcall miscompilation (PR #168956)

Folkert de Vries via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 22 11:52:57 PST 2025


================
@@ -2098,15 +2153,18 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
       isTailCall = false;
   }
 
-  if (isTailCall && !IsMustTail) {
+  if (isTailCall) {
     // Check if it's really possible to do a tail call.
-    isTailCall = IsEligibleForTailCallOptimization(CLI, CCInfo, ArgLocs,
-                                                   IsCalleePopSRet);
+    IsSibcall = IsEligibleForTailCallOptimization(CLI, CCInfo, ArgLocs,
+                                                  IsCalleePopSRet);
----------------
folkertdev wrote:

these changes to the sibcall logic are still needed to optimize to just a `jmp` in the case where arguments are just passed on (i.e. no stack shuffling is needed).

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


More information about the llvm-commits mailing list