[PATCH] D38730: X86: Fix X86CallFrameOptimization to search for the COPY StackPointer

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 06:57:59 PDT 2017


zvi created this revision.

SelectionDAG inserts a copy of ESP into a virtual register.
X86CallFrameOptimization assumed that the COPY, if present, is always
right after the call-frame setup instruction (ADJCALLSTACKDOWN). This was a
wrong assumption as the COPY can be located anywhere between the call-frame setup
instruction and its first use. If the COPY happened to be located in a different
location than what X86CallFrameOptimization assumed, visiting it while
processing the call chain would lead to a conservative bail-out.

The fix is quite straightfoward, scan ahead for the stack-pointer copy and make note
of it so it can be ignored while processing the call chain.

Fixes pr34903


https://reviews.llvm.org/D38730

Files:
  lib/Target/X86/X86CallFrameOptimization.cpp
  test/CodeGen/X86/cmpxchg-clobber-flags.ll
  test/CodeGen/X86/movtopush.ll
  test/CodeGen/X86/movtopush.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38730.118383.patch
Type: text/x-patch
Size: 9134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171010/01e419e5/attachment.bin>


More information about the llvm-commits mailing list