aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-03-31 23:19:51 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-03-31 23:19:51 +0000
commit4c7ab52dd1c8c290c89bc13f4351628a15ea9e7f (patch)
treedc250526b9a0b0024e77ee0067df56f6a4ea1623 /lib/Target
parent7174222a3bfffeec455ee2acd1c2570c017f39ec (diff)
downloadexternal_llvm-4c7ab52dd1c8c290c89bc13f4351628a15ea9e7f.zip
external_llvm-4c7ab52dd1c8c290c89bc13f4351628a15ea9e7f.tar.gz
external_llvm-4c7ab52dd1c8c290c89bc13f4351628a15ea9e7f.tar.bz2
It's not safe to fold a load from GV stub or constantpool into a two-address use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49002 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86InstrInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp
index ffe2083..8a54645 100644
--- a/lib/Target/X86/X86InstrInfo.cpp
+++ b/lib/Target/X86/X86InstrInfo.cpp
@@ -1825,7 +1825,15 @@ X86InstrInfo::foldMemoryOperand(MachineInstr *MI, unsigned i,
MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) {
OpcodeTablePtr = &RegOp2MemOpTable2Addr;
isTwoAddrFold = true;
+ // Can't write back to CPI or a GV stub.
+ if (MOs[3].isCPI() ||
+ (MOs[3].isGlobal() && isGVStub(MOs[3].getGlobal(), TM)))
+ return NULL;
} else if (i == 0) { // If operand 0
+ // Can't write back to CPI or a GV stub.
+ if (MOs[3].isCPI() ||
+ (MOs[3].isGlobal() && isGVStub(MOs[3].getGlobal(), TM)))
+ return NULL;
if (MI->getOpcode() == X86::MOV16r0)
NewMI = MakeM0Inst(*this, X86::MOV16mi, MOs, MI);
else if (MI->getOpcode() == X86::MOV32r0)