[PATCH] D105762: [X86] Teach X86FloatingPoint's handleCall to only erase the FP stack if there is a regmask operand that clobbers the FP stack.

Pengfei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 10 19:19:20 PDT 2021


pengfei added a comment.

> __alloca only updates EAX and ESP so this isn't wrong.

"is" or "isn't"?



================
Comment at: llvm/lib/Target/X86/X86FloatingPoint.cpp:988-989
     MachineOperand &Op = MI.getOperand(i);
+    // Check if this call clobbers the FP stack.
+    // is sufficient.
+    if (Op.isRegMask()) {
----------------
I found we don't clobber FP stack by default. E.g. `void foo(void)`. The interesting thing is even if we passing registers to/from foo, e.g. `long double foo(void)` or `long double foo(long double)`, the regmasks of FP are still 0.
Did I misunderstand something here?


================
Comment at: llvm/lib/Target/X86/X86FloatingPoint.cpp:995
+      for (unsigned i = 1; i != 8; ++i)
+        assert(Op.clobbersPhysReg(X86::FP0 + i) == ClobbersFP0 &&
+               "Inconsistent FP register clobber");
----------------
Why can't the callee only clobber one or a few registers?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105762



More information about the llvm-commits mailing list