craig.topper added inline comments.

================
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
----------------
void wrote:
> 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.
There was a mistake in my previous comment. The popq is being used in place of 
`add 8, %rsp`

In this case it probably is the value from the pushq. But %rax isn't a function 
argument so it is effectively garbage data. This is 
X86FrameLowering::emitSPUpdate scavenging %rax to use a pushq/popq instead of 
subtracting or adding to %rsp.

I think this is being done to align the stack for the call to fmod, but I'm not 
sure.

I think we can use a pushq like this to allocate stack space that gets 
overwritten before the popq.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110869

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to