OSDN Git Service

X86: Fix X86CallFrameOptimization to search for the COPY StackPointer
authorZvi Rackover <zvi.rackover@intel.com>
Tue, 24 Oct 2017 07:38:29 +0000 (07:38 +0000)
committerZvi Rackover <zvi.rackover@intel.com>
Tue, 24 Oct 2017 07:38:29 +0000 (07:38 +0000)
commit98150369032943ac04d6f1df4a3ed4b2787b0d01
tree1e89921c89a4e35b34823b91dbfa749ecfb982b2
parentce910e5be40b18d37d3932ed59e2cb0e5e472b14
X86: Fix X86CallFrameOptimization to search for the COPY StackPointer

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316416 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86CallFrameOptimization.cpp
test/CodeGen/X86/cmpxchg-clobber-flags.ll
test/CodeGen/X86/movtopush.ll
test/CodeGen/X86/movtopush.mir