[PATCH] D32205: X86RegisterInfo: eliminateFrameIndex: Force SP in AfterFPPop case; NFC

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 10:53:56 PDT 2017


MatzeB added a comment.

In https://reviews.llvm.org/D32205#735670, @rnk wrote:

> In https://reviews.llvm.org/D32205#735651, @MatzeB wrote:
>
> > As I feared this broke. One of the bots was compiling this pearl (from clang/lib/Lex/Pragma.cpp:992)
> >
> >   static void DebugOverflowStack() {
> >     void (*volatile Self)() = DebugOverflowStack;
> >     Self();
> >   }
> >   
> >
> > for which amazingly use an x86 memory operand on the tail call instruction. Seems like someone tried to trick the compiler into deliberately producing code that overflows the stack and we managed to optimize it into a sibling call without using extra stack (the red-zone is saving us from stack allocations).
>
>
> That's brilliant, because if we tail call, then this function won't cause a stack overflow! We might want to try harder by escaping `Self` to the call.
>
> Regardless, I guess the assertion isn't that important. We could go back to asserting that no dynamic stack realignment occurs.


Guess I'll try with `assert(!needsStackRealignment(MF) || MF.getFrameInfo().isFixedObjectIndex(FrameIndex))` this time.


Repository:
  rL LLVM

https://reviews.llvm.org/D32205





More information about the llvm-commits mailing list