Don't try to fold V_SET0 and V_SETALLONES to loads in medium and
authorDan Gohman <gohman@apple.com>
Tue, 9 Mar 2010 03:01:40 +0000 (03:01 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 9 Mar 2010 03:01:40 +0000 (03:01 +0000)
large code models.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98042 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp

index 39bda04b4d13b648deb2cbc3d4a37d0a743ee69c..4fd91bbc2fd85888a28f13a11fd5050356faa45d 100644 (file)
@@ -2525,6 +2525,11 @@ MachineInstr* X86InstrInfo::foldMemoryOperandImpl(MachineFunction &MF,
     // Folding a V_SET0 or V_SETALLONES as a load, to ease register pressure.
     // Create a constant-pool entry and operands to load from it.
 
+    // Medium and large mode can't fold loads this way.
+    if (TM.getCodeModel() != CodeModel::Small &&
+        TM.getCodeModel() != CodeModel::Kernel)
+      return NULL;
+
     // x86-32 PIC requires a PIC base register for constant pools.
     unsigned PICBase = 0;
     if (TM.getRelocationModel() == Reloc::PIC_) {