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

Thanks to Matthias Braun for spotting this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272358 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Quentin Colombet 2016-06-10 01:12:06 +00:00
parent aef5f640f7
commit 7f8e1c60de

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())