[PATCH] D21325: [X86] Fix tailcall return address clobber bug

Magnus Lång via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 07:30:56 PDT 2016

margnus1 created this revision.
margnus1 added a reviewer: qcolombet.
margnus1 added a subscriber: llvm-commits.

This bug (PR28124) was introduced by r237977, which refactored the tail call
sequence to be generated in two passes instead of one.

Unfortunately, the stack adjustment produced by the first pass was not
recognized by X86FrameLowering::mergeSPUpdates() in all cases, causing
code such as the following, which clobbers the return address, to be

    popl    %edi
    popl    %edi
    pushl   %eax
    jmp     tailcallee              # TAILCALL

By generalizing X86FrameLowering::mergeSPUpdates() to recognize a sequence of
pop instructions as a stack adjustment when the registers are not used by the
following return instruction, this bug is fixed.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21325.60682.patch
Type: text/x-patch
Size: 4896 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160614/525e04e9/attachment.bin>

More information about the llvm-commits mailing list