From 07636808acdb7c361afc4206975f2ddb46c49d50 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 10 May 2016 04:51:04 +0000 Subject: [PATCH] TargetPassConfig: Set PrintMachineCode even if addMachinePasses() does not run. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269013 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetPassConfig.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/TargetPassConfig.cpp b/lib/CodeGen/TargetPassConfig.cpp index 031da7290de..febe13c9c4c 100644 --- a/lib/CodeGen/TargetPassConfig.cpp +++ b/lib/CodeGen/TargetPassConfig.cpp @@ -258,6 +258,9 @@ TargetPassConfig::TargetPassConfig(TargetMachine *tm, PassManagerBase &pm) // Substitute Pseudo Pass IDs for real ones. substitutePass(&EarlyTailDuplicateID, &TailDuplicateID); substitutePass(&PostRAMachineLICMID, &MachineLICMID); + + if (StringRef(PrintMachineInstrs.getValue()).equals("")) + TM->Options.PrintMachineCode = true; } CodeGenOpt::Level TargetPassConfig::getOptLevel() const { @@ -519,11 +522,8 @@ void TargetPassConfig::addMachinePasses() { AddingMachinePasses = true; // Insert a machine instr printer pass after the specified pass. - // If -print-machineinstrs specified, print machineinstrs after all passes. - if (StringRef(PrintMachineInstrs.getValue()).equals("")) - TM->Options.PrintMachineCode = true; - else if (!StringRef(PrintMachineInstrs.getValue()) - .equals("option-unspecified")) { + if (!StringRef(PrintMachineInstrs.getValue()).equals("") && + !StringRef(PrintMachineInstrs.getValue()).equals("option-unspecified")) { const PassRegistry *PR = PassRegistry::getPassRegistry(); const PassInfo *TPI = PR->getPassInfo(PrintMachineInstrs.getValue()); const PassInfo *IPI = PR->getPassInfo(StringRef("machineinstr-printer")); -- 2.50.1