[llc] Do not create the pass config several times for run-pass.

Thanks to Matthias Braun for spotting this.

llvm-svn: 272358
This commit is contained in:
Quentin Colombet 2016-06-10 01:12:06 +00:00
parent c83bf82ad8
commit 6a88ba6f34
1 changed files with 7 additions and 6 deletions

View File

@ -411,18 +411,19 @@ static int compileModule(char **argv, LLVMContext &Context) {
errs() << argv[0] << ": run-pass needs a .mir input.\n";
return 1;
}
LLVMTargetMachine &LLVMTM = static_cast<LLVMTargetMachine&>(*Target);
TargetPassConfig *TPC = LLVMTM.createPassConfig(PM);
PM.add(TPC);
LLVMTM.addMachineModuleInfo(PM);
LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());
TPC->printAndVerify("");
for (std::string &RunPassName : *RunPassNames) {
const PassInfo *PI = PR->getPassInfo(RunPassName);
if (!PI) {
errs() << argv[0] << ": run-pass " << RunPassName << " is not registered.\n";
return 1;
}
LLVMTargetMachine &LLVMTM = static_cast<LLVMTargetMachine&>(*Target);
TargetPassConfig *TPC = LLVMTM.createPassConfig(PM);
PM.add(TPC);
LLVMTM.addMachineModuleInfo(PM);
LLVMTM.addMachineFunctionAnalysis(PM, MIR.get());
TPC->printAndVerify("");
Pass *P;
if (PI->getTargetMachineCtor())