[llvm] [X86] Don't emit x87 register scrub when x87 is unavailable (PR #211146)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 20:55:12 PDT 2026


================
@@ -618,10 +618,11 @@ void X86FrameLowering::emitZeroCallUsedRegs(BitVector RegsToZero,
     DL = MBBI->getDebugLoc();
 
   // Zero out FP stack if referenced. Do this outside of the loop below so that
-  // it's done only once.
+  // it's done only once. Skip it when x87 is unavailable (e.g. -mno-x87 /
+  // -msoft-float).
   const X86Subtarget &ST = MF.getSubtarget<X86Subtarget>();
   for (MCRegister Reg : RegsToZero.set_bits()) {
-    if (!X86::RFP80RegClass.contains(Reg))
+    if (!X86::RFP80RegClass.contains(Reg) || ST.useSoftFloat() || !ST.hasX87())
----------------
phoebewang wrote:

Why do we have these bits when X87 disabled? Should not set them at the beginning?

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


More information about the llvm-commits mailing list