aboutsummaryrefslogtreecommitdiff
path: root/lib/IR/LegacyPassManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/LegacyPassManager.cpp')
-rw-r--r--lib/IR/LegacyPassManager.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/IR/LegacyPassManager.cpp b/lib/IR/LegacyPassManager.cpp
index 01d14f17bba5..c575d6e782b9 100644
--- a/lib/IR/LegacyPassManager.cpp
+++ b/lib/IR/LegacyPassManager.cpp
@@ -1,9 +1,8 @@
//===- LegacyPassManager.cpp - LLVM Pass Infrastructure Implementation ----===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -28,6 +27,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/Mutex.h"
+#include "llvm/Support/TimeProfiler.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
@@ -310,7 +310,7 @@ void PassManagerPrettyStackEntry::print(raw_ostream &OS) const {
OS << "value";
OS << " '";
- V->printAsOperand(OS, /*PrintTy=*/false, M);
+ V->printAsOperand(OS, /*PrintType=*/false, M);
OS << "'\n";
}
@@ -1629,10 +1629,14 @@ bool FPPassManager::runOnFunction(Function &F) {
FunctionSize = F.getInstructionCount();
}
+ llvm::TimeTraceScope FunctionScope("OptFunction", F.getName());
+
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
FunctionPass *FP = getContainedPass(Index);
bool LocalChanged = false;
+ llvm::TimeTraceScope PassScope("RunPass", FP->getPassName());
+
dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
dumpRequiredSet(FP);
@@ -1669,12 +1673,14 @@ bool FPPassManager::runOnFunction(Function &F) {
recordAvailableAnalysis(FP);
removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
}
+
return Changed;
}
bool FPPassManager::runOnModule(Module &M) {
bool Changed = false;
+ llvm::TimeTraceScope TimeScope("OptModule", M.getName());
for (Function &F : M)
Changed |= runOnFunction(F);
@@ -1707,6 +1713,8 @@ bool FPPassManager::doFinalization(Module &M) {
/// the module, and if so, return true.
bool
MPPassManager::runOnModule(Module &M) {
+ llvm::TimeTraceScope TimeScope("OptModule", M.getName());
+
bool Changed = false;
// Initialize on-the-fly passes
@@ -1719,14 +1727,12 @@ MPPassManager::runOnModule(Module &M) {
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index)
Changed |= getContainedPass(Index)->doInitialization(M);
- unsigned InstrCount, ModuleCount = 0;
+ unsigned InstrCount;
StringMap<std::pair<unsigned, unsigned>> FunctionToInstrCount;
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
// Collect the initial size of the module.
- if (EmitICRemark) {
+ if (EmitICRemark)
InstrCount = initSizeRemarkInfo(M, FunctionToInstrCount);
- ModuleCount = InstrCount;
- }
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
@@ -1744,7 +1750,7 @@ MPPassManager::runOnModule(Module &M) {
LocalChanged |= MP->runOnModule(M);
if (EmitICRemark) {
// Update the size of the module.
- ModuleCount = M.getInstructionCount();
+ unsigned ModuleCount = M.getInstructionCount();
if (ModuleCount != InstrCount) {
int64_t Delta = static_cast<int64_t>(ModuleCount) -
static_cast<int64_t>(InstrCount);