diff options
| author | Matthias Braun <matze@braunis.de> | 2016-08-23 20:58:29 +0000 |
|---|---|---|
| committer | Matthias Braun <matze@braunis.de> | 2016-08-23 20:58:29 +0000 |
| commit | 4c1f1f120c9da460a7b1d1f24936499d8caeae11 (patch) | |
| tree | 666d4ef636a0d25b6210ac0b3a3b377b026f7275 /llvm/tools | |
| parent | 54690dcdb00d73e7136aade84949666a7047f8cc (diff) | |
| download | bcm5719-llvm-4c1f1f120c9da460a7b1d1f24936499d8caeae11.tar.gz bcm5719-llvm-4c1f1f120c9da460a7b1d1f24936499d8caeae11.zip | |
CodeGen: Remove MachineFunctionAnalysis => Enable (Machine)ModulePasses
Re-apply this commit with the deletion of a MachineFunction delegated to
a separate pass to avoid use after free when doing this directly in
AsmPrinter.
This patch removes the MachineFunctionAnalysis. Instead we keep a
map from IR Function to MachineFunction in the MachineModuleInfo.
This allows the insertion of ModulePasses into the codegen pipeline
without breaking it because the MachineFunctionAnalysis gets dropped
before a module pass.
Peak memory should stay unchanged without a ModulePass in the codegen
pipeline: Previously the MachineFunction was freed at the end of a codegen
function pipeline because the MachineFunctionAnalysis was dropped; With
this patch the MachineFunction is freed after the AsmPrinter has
finished.
Differential Revision: http://reviews.llvm.org/D23736
llvm-svn: 279564
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/llc/llc.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index 250d2765104..22273d4b2d0 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -450,8 +450,7 @@ static int compileModule(char **argv, LLVMContext &Context) { LLVMTargetMachine &LLVMTM = static_cast<LLVMTargetMachine&>(*Target); TargetPassConfig &TPC = *LLVMTM.createPassConfig(PM); PM.add(&TPC); - LLVMTM.addMachineModuleInfo(PM); - LLVMTM.addMachineFunctionAnalysis(PM, MIR.get()); + LLVMTM.addMachineModuleInfo(PM, MIR.get()); TPC.printAndVerify(""); for (const std::string &RunPassName : *RunPassNames) { |

