summaryrefslogtreecommitdiff
path: root/lib/Target/X86/X86SelectionDAGInfo.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-02-13 13:40:35 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-02-13 13:40:35 +0000
commitf09e02f01a817f4daf95ef8d3f1f2545297d32e7 (patch)
tree73711f287e01d7e5e32364dee462c2f1f919aa5c /lib/Target/X86/X86SelectionDAGInfo.cpp
parent0f80f7bfd72c2a3b49bdd2ac6cd611cad0e6938a (diff)
downloadllvm-f09e02f01a817f4daf95ef8d3f1f2545297d32e7.tar.gz
llvm-f09e02f01a817f4daf95ef8d3f1f2545297d32e7.tar.bz2
llvm-f09e02f01a817f4daf95ef8d3f1f2545297d32e7.tar.xz
X86: Disable generation of rep;movsl when %esi is used as a base pointer.
This happens when there is both stack realignment and a dynamic alloca in the function. If we overwrite %esi (rep;movsl uses fixed registers) we'll lose the base pointer and the next register spill will write into oblivion. Fixes PR15249 and unbreaks firefox on i386/freebsd. Mozilla uses dynamic allocas and freebsd a 4 byte stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86SelectionDAGInfo.cpp')
-rw-r--r--lib/Target/X86/X86SelectionDAGInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/X86/X86SelectionDAGInfo.cpp b/lib/Target/X86/X86SelectionDAGInfo.cpp
index 757e8c70a4..f934fdd859 100644
--- a/lib/Target/X86/X86SelectionDAGInfo.cpp
+++ b/lib/Target/X86/X86SelectionDAGInfo.cpp
@@ -202,6 +202,14 @@ X86SelectionDAGInfo::EmitTargetCodeForMemcpy(SelectionDAG &DAG, DebugLoc dl,
SrcPtrInfo.getAddrSpace() >= 256)
return SDValue();
+ // ESI might be used as a base pointer, in that case we can't simply overwrite
+ // the register. Fall back to generic code.
+ const X86RegisterInfo *TRI =
+ static_cast<const X86RegisterInfo *>(DAG.getTarget().getRegisterInfo());
+ if (TRI->hasBasePointer(DAG.getMachineFunction()) &&
+ TRI->getBaseRegister() == X86::ESI)
+ return SDValue();
+
MVT AVT;
if (Align & 1)
AVT = MVT::i8;