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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 15:38:24 PST 2022


craig.topper 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().
----------------
Should the frontend avoid putting the attribute on "main" instead of making a special case in the backend?


================
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
----------------
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`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110869



More information about the llvm-commits mailing list