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

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 18:12:06 PDT 2016


Author: qcolombet
Date: Thu Jun  9 20:12:06 2016
New Revision: 272358

URL: http://llvm.org/viewvc/llvm-project?rev=272358&view=rev
Log:
[llc] Do not create the pass config several times for run-pass.

Thanks to Matthias Braun for spotting this.

Modified:
    llvm/trunk/tools/llc/llc.cpp

Modified: llvm/trunk/tools/llc/llc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=272358&r1=272357&r2=272358&view=diff
==============================================================================
--- llvm/trunk/tools/llc/llc.cpp (original)
+++ llvm/trunk/tools/llc/llc.cpp Thu Jun  9 20:12:06 2016
@@ -411,18 +411,19 @@ static int compileModule(char **argv, LL
         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())




More information about the llvm-commits mailing list