[PATCH] D57970: [WinEH] Allocate unique stack slots for xmm CSRs in funclets

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 8 12:40:03 PST 2019


rnk added inline comments.


================
Comment at: test/CodeGen/X86/catchpad-realign-savexmm.ll:65-66
+; CHECK:	leaq	80(%rdx), %rbp
+; CHECK:	movapd	%xmm6, -32(%rbp)        # 16-byte Spill
+; CHECK:	.seh_savexmm 6, 48
+; CHECK:	.seh_endprologue
----------------
I don't think this will work long in practice because we are storing XMM into the parent function's stack frame, but the .seh_savexmm directive describes locations relative the the funclet's RSP. So, when the stack is unwound, (throw an exception out of a catch block) XMM CSRs will not be restored correctly.

Another idea I had for fixing this was to change X86FrameLowering::getFrameIndexReference to do something special for XMM CSRs (we should be able to find the list of them somewhere), and resolve them to some SP-relative offset in the funclet's frame. We'll have to adjust the "SUB RSP, 32" that we currently emit for every funclet as well for that to work.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D57970





More information about the llvm-commits mailing list