from the old pass manager in the new one. I'm not trying to support (initially) the numerous options that are currently available to customize the pass pipeline. If we end up really wanting them, we can add them later, but I suspect many are no longer interesting. The simplicity of omitting them will help a lot as we sort out what the pipeline should look like in the new PM. I've also documented to the best of my ability *why* each pass or group of passes is used so that reading the pipeline is more helpful. In many cases I think we have some questionable choices of ordering and I've left FIXME comments in place so we know what to come back and revisit going forward. But for now, I've left it as similar to the current pipeline as I could. Lastly, I've had to comment out several places where passes are not ported to the new pass manager or where the loop pass infrastructure is not yet ready. I did at least fix a few bugs in the loop pass infrastructure uncovered by running the full pipeline, but I didn't want to go too far in this patch -- I'll come back and re-enable these as the infrastructure comes online. But I'd like to keep the comments in place because I don't want to lose track of which passes need to be enabled and where they go. One thing that seemed like a significant API improvement was to require that we don't build pipelines for O0. It seems to have no real benefit. I've also switched back to returning pass managers by value as at this API layer it feels much more natural to me for composition. But if others disagree, I'm happy to go back to an output parameter. I'm not 100% happy with the testing strategy currently, but it seems at least OK. I may come back and try to refactor or otherwise improve this in subsequent patches but I wanted to at least get a good starting point in place. Differential Revision: https://reviews.llvm.org/D28042 llvm-svn: 290325
59 lines
2.0 KiB
C++
59 lines
2.0 KiB
C++
//===- LoopPassManager.cpp - Loop pass management -------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Analysis/LoopPassManager.h"
|
|
#include "llvm/Analysis/BasicAliasAnalysis.h"
|
|
#include "llvm/Analysis/GlobalsModRef.h"
|
|
#include "llvm/Analysis/LoopInfo.h"
|
|
#include "llvm/Analysis/ScalarEvolution.h"
|
|
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
|
|
#include "llvm/IR/Dominators.h"
|
|
|
|
using namespace llvm;
|
|
|
|
// Explicit template instantiations and specialization defininitions for core
|
|
// template typedefs.
|
|
namespace llvm {
|
|
template class PassManager<Loop>;
|
|
template class AnalysisManager<Loop>;
|
|
template class InnerAnalysisManagerProxy<LoopAnalysisManager, Function>;
|
|
template class OuterAnalysisManagerProxy<FunctionAnalysisManager, Loop>;
|
|
|
|
template <>
|
|
bool LoopAnalysisManagerFunctionProxy::Result::invalidate(
|
|
Function &F, const PreservedAnalyses &PA,
|
|
FunctionAnalysisManager::Invalidator &Inv) {
|
|
// If this proxy isn't marked as preserved, the set of Function objects in
|
|
// the module may have changed. We therefore can't call
|
|
// InnerAM->invalidate(), because any pointers to Functions it has may be
|
|
// stale.
|
|
if (!PA.preserved(LoopAnalysisManagerFunctionProxy::ID()))
|
|
InnerAM->clear();
|
|
|
|
// FIXME: Proper suppor for invalidation isn't yet implemented for the LPM.
|
|
|
|
// Return false to indicate that this result is still a valid proxy.
|
|
return false;
|
|
}
|
|
}
|
|
|
|
PreservedAnalyses llvm::getLoopPassPreservedAnalyses() {
|
|
PreservedAnalyses PA;
|
|
PA.preserve<DominatorTreeAnalysis>();
|
|
PA.preserve<LoopAnalysis>();
|
|
PA.preserve<ScalarEvolutionAnalysis>();
|
|
// TODO: What we really want to do here is preserve an AA category, but that
|
|
// concept doesn't exist yet.
|
|
PA.preserve<AAManager>();
|
|
PA.preserve<BasicAA>();
|
|
PA.preserve<GlobalsAA>();
|
|
PA.preserve<SCEVAA>();
|
|
return PA;
|
|
}
|