[PATCH] D43968: [X86] Handle EAX being live when calling chkstk for x86_64

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 00:26:33 PST 2018


mstorsjo added a comment.

In https://reviews.llvm.org/D43968#1024556, @rnk wrote:

> I see, shrink-wrapping makes it so that EAX may be live into the prologue.
>
> I don't like that the CFI becomes imprecise, though. The user won't be able to break on `__chkstk` and take a backtrace. Does that work today when shrink wrapping isn't in use?


It doesn't seem so; both with dwarf and SEH, and GCC with SEH, I get an incorrect backtrace in gdb when breaking on `___chkstk_ms` in this case. (Breakpoints in other places give proper backtraces though.)

> If not, then let's just do this. If it does work, we should consider emitting an 8 byte .seh_stackalloc for the push or RAX and a smaller update after `__chkstk`.

Well, this case isn't too relevant for SEH at all, since shrink wrapping is disabled altogether when SEH is enabled - in lib/CodeGen/ShrinkWrap.cpp, ShrinkWrap::isShrinkWrapEnabled:

  bool ShrinkWrap::isShrinkWrapEnabled(const MachineFunction &MF) {
    const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
  
    switch (EnableShrinkWrapOpt) {
    case cl::BOU_UNSET:
      return TFI->enableShrinkWrapping(MF) &&
             // Windows with CFI has some limitations that make it impossible
             // to use shrink-wrapping.
             !MF.getTarget().getMCAsmInfo()->usesWindowsCFI() &&


Repository:
  rL LLVM

https://reviews.llvm.org/D43968





More information about the llvm-commits mailing list