diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-23 22:08:27 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-23 22:08:27 +0000 |
commit | 8c3fbdc6c4649f8c3c018cf32be4407c672e574c (patch) | |
tree | 4b1501127fddc6956350b27ea9cba6d871ef28ed /llvm/lib/CodeGen/LLVMTargetMachine.cpp | |
parent | d0cfb7344e101f656be024d29d9cd0aaefea4288 (diff) | |
download | bcm5719-llvm-8c3fbdc6c4649f8c3c018cf32be4407c672e574c.tar.gz bcm5719-llvm-8c3fbdc6c4649f8c3c018cf32be4407c672e574c.zip |
Revert r279564. It introduces undefined behavior (binding a reference to a
dereferenced null pointer) in MachineModuleInfo::MachineModuleInfo that causes
-Werror builds (including several buildbots) to fail.
llvm-svn: 279580
Diffstat (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LLVMTargetMachine.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 27acb306a65..9ed61c6685b 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/Passes.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/BasicTTIImpl.h" +#include "llvm/CodeGen/MachineFunctionAnalysis.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/CodeGen/TargetPassConfig.h" @@ -102,15 +103,19 @@ TargetIRAnalysis LLVMTargetMachine::getTargetIRAnalysis() { } MachineModuleInfo & -LLVMTargetMachine::addMachineModuleInfo(PassManagerBase &PM, - MachineFunctionInitializer *MFI) const { - MachineModuleInfo *MMI = new MachineModuleInfo(*this, *getMCAsmInfo(), +LLVMTargetMachine::addMachineModuleInfo(PassManagerBase &PM) const { + MachineModuleInfo *MMI = new MachineModuleInfo(*getMCAsmInfo(), *getMCRegisterInfo(), - getObjFileLowering(), MFI); + getObjFileLowering()); PM.add(MMI); return *MMI; } +void LLVMTargetMachine::addMachineFunctionAnalysis(PassManagerBase &PM, + MachineFunctionInitializer *MFInitializer) const { + PM.add(new MachineFunctionAnalysis(*this, MFInitializer)); +} + /// addPassesToX helper drives creation and initialization of TargetPassConfig. static MCContext * addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM, @@ -145,7 +150,8 @@ addPassesToGenerateCode(LLVMTargetMachine *TM, PassManagerBase &PM, PassConfig->addISelPrepare(); - MachineModuleInfo &MMI = TM->addMachineModuleInfo(PM, MFInitializer); + MachineModuleInfo &MMI = TM->addMachineModuleInfo(PM); + TM->addMachineFunctionAnalysis(PM, MFInitializer); // Enable FastISel with -fast, but allow that to be overridden. TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE); @@ -267,7 +273,6 @@ bool LLVMTargetMachine::addPassesToEmitFile( return true; PM.add(Printer); - PM.add(createFreeMachineFunctionPass()); return false; } @@ -314,7 +319,6 @@ bool LLVMTargetMachine::addPassesToEmitMC(PassManagerBase &PM, MCContext *&Ctx, return true; PM.add(Printer); - PM.add(createFreeMachineFunctionPass()); return false; // success! } |