Check for dynamic allocas and inline asm that clobbers sp before building
authorHans Wennborg <hans@hanshq.net>
Wed, 5 Mar 2014 02:43:26 +0000 (02:43 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 5 Mar 2014 02:43:26 +0000 (02:43 +0000)
commit2f471c83a0bb19806053e2d784a97f153fbb8771
treef886f798e01115292c0d04256abe2e65f85bf087
parent3b9afd308728feb1853596bbb8ccd57cf5f6b3b9
Check for dynamic allocas and inline asm that clobbers sp before building
selection dag (PR19012)

In X86SelectionDagInfo::EmitTargetCodeForMemcpy we check with MachineFrameInfo
to make sure that ESI isn't used as a base pointer register before we choose to
emit rep movs (which clobbers esi).

The problem is that MachineFrameInfo wouldn't know about dynamic allocas or
inline asm that clobbers the stack pointer until SelectionDAGBuilder has
encountered them.

This patch fixes the problem by checking for such things when building the
FunctionLoweringInfo.

Differential Revision: http://llvm-reviews.chandlerc.com/D2954

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202930 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/FunctionLoweringInfo.h
include/llvm/CodeGen/MachineFrameInfo.h
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
test/CodeGen/X86/inline-asm-sp-clobber-memcpy.ll [new file with mode: 0644]
test/CodeGen/X86/stack-align-memcpy.ll