[all-commits] [llvm/llvm-project] c089f0: [X86] Don't setup and teardown memory for a mustta...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Fri Dec 6 13:09:37 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c089f0289856b8f72b06c30daa7848e431c8e36e
      https://github.com/llvm/llvm-project/commit/c089f0289856b8f72b06c30daa7848e431c8e36e
  Author: Reid Kleckner <rnk at google.com>
  Date:   2019-12-06 (Fri, 06 Dec 2019)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/cfguard-checks.ll
    A llvm/test/CodeGen/X86/musttail-inalloca.ll
    M llvm/test/CodeGen/X86/musttail-tailcc.ll
    M llvm/test/CodeGen/X86/musttail-varargs.ll

  Log Message:
  -----------
  [X86] Don't setup and teardown memory for a musttail call

Summary:
musttail calls should not require allocating extra stack for arguments.
Updates to arguments passed in memory should happen in place before the
epilogue.

This bug was mostly a missed optimization, unless inalloca was used and
store to push conversion fired.

If a reserved call frame was used for an inalloca musttail call, the
call setup and teardown instructions would be deleted, and SP
adjustments would be inserted in the prologue and epilogue. You can see
these are removed from several test cases in this change.

In the case where the stack frame was not reserved, i.e. call frame
optimization fires and turns argument stores into pushes, then the
imbalanced call frame setup instructions created for inalloca calls
become a problem. They remain in the instruction stream, resulting in a
call setup that allocates zero bytes (expected for inalloca), and a call
teardown that deallocates the inalloca pack. This deallocation was
unbalanced, leading to subsequent crashes.

Reviewers: hans

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71097




More information about the All-commits mailing list