From 4c7ab52dd1c8c290c89bc13f4351628a15ea9e7f Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Mon, 31 Mar 2008 23:19:51 +0000 Subject: 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 --- lib/Target/X86/X86InstrInfo.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Target') 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) -- cgit v1.1