diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 313d362d94e4..30963a2ea903 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -273,7 +273,7 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, // Create the code emitter for the target if it exists. If not, .o file // emission fails. - const MCRegisterInfo &MRI = *getTarget().createMCRegInfo(getTargetTriple()); + const MCRegisterInfo &MRI = *getRegisterInfo(); const MCSubtargetInfo &STI = getSubtarget(); MCCodeEmitter *MCE = getTarget().createMCCodeEmitter(*getInstrInfo(), MRI, STI, *Ctx); diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 7f7c37f50e20..b6c9299c65b5 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -419,8 +419,6 @@ int main(int argc, char **argv, char * const *envp) { builder.setRelocationModel(RelocModel); builder.setCodeModel(CMModel); builder.setErrorStr(&ErrorMsg); - builder.setJITMemoryManager(ForceInterpreter ? 0 : - JITMemoryManager::CreateDefaultMemManager()); builder.setEngineKind(ForceInterpreter ? EngineKind::Interpreter : EngineKind::JIT); @@ -435,6 +433,9 @@ int main(int argc, char **argv, char * const *envp) { builder.setUseMCJIT(true); JMM = new LLIMCJITMemoryManager(); builder.setJITMemoryManager(JMM); + } else { + builder.setJITMemoryManager(ForceInterpreter ? 0 : + JITMemoryManager::CreateDefaultMemManager()); } CodeGenOpt::Level OLvl = CodeGenOpt::Default;