[PATCH] Check for dynamic allocas and inline asm that clobbers sp before building selection dag (PR19012)

Hans Wennborg hans at chromium.org
Tue Mar 4 17:46:27 PST 2014


Hi rnk,

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.

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

Files:
  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
  test/CodeGen/X86/stack-align-memcpy.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2954.1.patch
Type: text/x-patch
Size: 7717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140304/01ba7ade/attachment.bin>


More information about the llvm-commits mailing list