[PATCH] D110869: [X86] Implement -fzero-call-used-regs option

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 16:05:49 PST 2022


void marked 2 inline comments as done.
void added inline comments.


================
Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1182
+
+  if (!F.hasFnAttribute("zero-call-used-regs") ||
+      // No need to zero call regs in main().
----------------
craig.topper wrote:
> Should the frontend avoid putting the attribute on "main" instead of making a special case in the backend?
Sure.


================
Comment at: llvm/test/CodeGen/X86/zero-call-used-regs-fmod.ll:15
+; CHECK-NEXT:    xorps %xmm1, %xmm1
+; CHECK-NEXT:    popq %rax
+; CHECK-NEXT:    .cfi_def_cfa_offset 8
----------------
craig.topper wrote:
> Is it ok that this popq popped garbage into the %rax after you cleared it? It's not the return value of the function. That's xmm0. This is just a popq because its a shorter encoding than `sub 8, %esp`
It's getting the value back from the `pushq %rax` instruction, isn't it? We shouldn't be clearing it, though. I'll see if I can fix that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110869



More information about the cfe-commits mailing list