mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[NewPM] Separate out alias analysis passes in opt
Summary: This somewhat matches the --aa-pipeline option, which separates out any AA analyses to make sure they run before other passes. Makes check-llvm failures under new PM go from 2356 -> 2303. AA passes are not handled by PassBuilder::parsePassPipeline() but rather PassBuilder::parseAAPipeline(), which is why this fixes some failures. Reviewers: asbirlea, hans, ychen, leonardchan Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D82488
This commit is contained in:
parent
9abae52291
commit
c0c8bb0361
@ -515,6 +515,9 @@ public:
|
||||
/// returns false.
|
||||
Error parseAAPipeline(AAManager &AA, StringRef PipelineText);
|
||||
|
||||
/// Returns true if the pass name is the name of an alias analysis pass.
|
||||
bool isAAPassName(StringRef PassName);
|
||||
|
||||
/// Register a callback for a default optimizer pipeline extension
|
||||
/// point
|
||||
///
|
||||
|
@ -2657,3 +2657,11 @@ Error PassBuilder::parseAAPipeline(AAManager &AA, StringRef PipelineText) {
|
||||
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
bool PassBuilder::isAAPassName(StringRef PassName) {
|
||||
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
|
||||
if (PassName == NAME) \
|
||||
return true;
|
||||
#include "PassRegistry.def"
|
||||
return false;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "NewPMDriver.h"
|
||||
#include "PassPrinters.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Analysis/AliasAnalysis.h"
|
||||
#include "llvm/Analysis/CGSCCPassManager.h"
|
||||
@ -306,9 +307,26 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
||||
// Specially handle the alias analysis manager so that we can register
|
||||
// a custom pipeline of AA passes with it.
|
||||
AAManager AA;
|
||||
if (auto Err = PB.parseAAPipeline(AA, AAPipeline)) {
|
||||
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
|
||||
return false;
|
||||
if (!AAPipeline.empty()) {
|
||||
assert(Passes.empty() &&
|
||||
"--aa-pipeline and -foo-pass should not both be specified");
|
||||
if (auto Err = PB.parseAAPipeline(AA, AAPipeline)) {
|
||||
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// For compatibility with legacy pass manager.
|
||||
// Alias analyses are not specially specified when using the legacy PM.
|
||||
SmallVector<StringRef, 4> NonAAPasses;
|
||||
for (auto PassName : Passes) {
|
||||
if (PB.isAAPassName(PassName)) {
|
||||
if (auto Err = PB.parseAAPipeline(AA, PassName)) {
|
||||
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
NonAAPasses.push_back(PassName);
|
||||
}
|
||||
}
|
||||
|
||||
LoopAnalysisManager LAM(DebugPM);
|
||||
@ -341,7 +359,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (auto PassName : Passes) {
|
||||
for (auto PassName : NonAAPasses) {
|
||||
if (auto Err =
|
||||
PB.parsePassPipeline(MPM, PassName, VerifyEachPass, DebugPM)) {
|
||||
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user