Fix yet-another bug I introduced into fastisel, this time handling
[oota-llvm.git] / lib / Target / X86 / X86FastISel.cpp
index bd994dea8f414af491e42798d035aca01d162963..dcb8852a89bf7b7665116f5e782a88c23ed56e0d 100644 (file)
@@ -1514,7 +1514,9 @@ unsigned X86FastISel::TargetMaterializeConstant(Constant *C) {
     } else if (Subtarget->isPICStyleGOT()) {
       OpFlag = X86II::MO_GOTOFF;
       PICBase = getInstrInfo()->getGlobalBaseReg(&MF);
-    }
+    } else if (Subtarget->isPICStyleRIPRel() &&
+               TM.getCodeModel() == CodeModel::Small)
+      PICBase = X86::RIP;
   }
 
   // Create the load from the constant pool.