1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[NewPM][opt] Translate -foo-analysis to require<foo-analysis>

Fixes 53 check-llvm tests under NPM.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D83633
This commit is contained in:
Arthur Eubanks 2020-07-13 11:10:56 -07:00
parent 9485ea1e41
commit 084b730605
3 changed files with 25 additions and 2 deletions

View File

@ -518,6 +518,9 @@ public:
/// Returns true if the pass name is the name of an alias analysis pass.
bool isAAPassName(StringRef PassName);
/// Returns true if the pass name is the name of a (non-alias) analysis pass.
bool isAnalysisPassName(StringRef PassName);
/// Register a callback for a default optimizer pipeline extension
/// point
///

View File

@ -2666,3 +2666,20 @@ bool PassBuilder::isAAPassName(StringRef PassName) {
#include "PassRegistry.def"
return false;
}
bool PassBuilder::isAnalysisPassName(StringRef PassName) {
#define MODULE_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define FUNCTION_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define LOOP_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define CGSSC_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#include "PassRegistry.def"
return false;
}

View File

@ -358,8 +358,11 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
}
}
for (auto PassName : NonAAPasses) {
if (auto Err =
PB.parsePassPipeline(MPM, PassName, VerifyEachPass, DebugPM)) {
std::string ModifiedPassName(PassName.begin(), PassName.end());
if (PB.isAnalysisPassName(PassName))
ModifiedPassName = "require<" + ModifiedPassName + ">";
if (auto Err = PB.parsePassPipeline(MPM, ModifiedPassName, VerifyEachPass,
DebugPM)) {
errs() << Arg0 << ": " << toString(std::move(Err)) << "\n";
return false;
}