diff options
Diffstat (limited to 'lib/Analysis/LoopPass.cpp')
-rw-r--r-- | lib/Analysis/LoopPass.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp index a68f114b83a0..4ab3798039d8 100644 --- a/lib/Analysis/LoopPass.cpp +++ b/lib/Analysis/LoopPass.cpp @@ -1,9 +1,8 @@ //===- LoopPass.cpp - Loop Pass and Loop Pass Manager ---------------------===// // -// 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 // //===----------------------------------------------------------------------===// // @@ -23,6 +22,7 @@ #include "llvm/IR/PassTimingInfo.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" +#include "llvm/Support/TimeProfiler.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -210,6 +210,8 @@ bool LPPassManager::runOnFunction(Function &F) { for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { LoopPass *P = getContainedPass(Index); + llvm::TimeTraceScope LoopPassScope("RunLoopPass", P->getPassName()); + dumpPassInfo(P, EXECUTION_MSG, ON_LOOP_MSG, CurrentLoop->getHeader()->getName()); dumpRequiredSet(P); @@ -384,16 +386,20 @@ void LoopPass::assignPassManager(PMStack &PMS, LPPM->add(this); } +static std::string getDescription(const Loop &L) { + return "loop"; +} + bool LoopPass::skipLoop(const Loop *L) const { const Function *F = L->getHeader()->getParent(); if (!F) return false; // Check the opt bisect limit. - LLVMContext &Context = F->getContext(); - if (!Context.getOptPassGate().shouldRunPass(this, *L)) + OptPassGate &Gate = F->getContext().getOptPassGate(); + if (Gate.isEnabled() && !Gate.shouldRunPass(this, getDescription(*L))) return true; // Check for the OptimizeNone attribute. - if (F->hasFnAttribute(Attribute::OptimizeNone)) { + if (F->hasOptNone()) { // FIXME: Report this to dbgs() only once per function. LLVM_DEBUG(dbgs() << "Skipping pass '" << getPassName() << "' in function " << F->getName() << "\n"); |