ReMat of load from stub in pic mode extends the life of pic base. Currently spiller...
authorEvan Cheng <evan.cheng@apple.com>
Tue, 1 Apr 2008 23:26:12 +0000 (23:26 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 1 Apr 2008 23:26:12 +0000 (23:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49059 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp

index ffe20833228dfd1ee8138052bdd557a24901a7e0..c9de586e78df1622afdf2d6f1035cecf332b2faf 100644 (file)
@@ -37,6 +37,10 @@ namespace {
                     cl::desc("Print instructions that the allocator wants to"
                              " fuse, but the X86 backend currently can't"),
                     cl::Hidden);
+  cl::opt<bool>
+  ReMatPICStubLoad("remat-pic-stub-load",
+                   cl::desc("Re-materialize load from stub in PIC mode"),
+                   cl::init(false), cl::Hidden);
 }
 
 X86InstrInfo::X86InstrInfo(X86TargetMachine &tm)
@@ -782,6 +786,8 @@ bool X86InstrInfo::isReallyTriviallyReMaterializable(MachineInstr *MI) const {
         if (BaseReg == 0)
           return true;
         // Allow re-materialization of PIC load.
+        if (!ReMatPICStubLoad && MI->getOperand(4).isGlobal())
+          return false;
         MachineRegisterInfo &MRI = MI->getParent()->getParent()->getRegInfo();
         bool isPICBase = false;
         for (MachineRegisterInfo::def_iterator I = MRI.def_begin(BaseReg),