1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[NPM] Translate alias analysis into require<> as well

'require<globals-aa>' is needed to make globals-aa work in NPM, since
globals-aa is a module analysis but function passes cannot run module
analyses on demand.
So don't skip translating alias analyses to 'require<>'.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D87743
This commit is contained in:
Arthur Eubanks 2020-09-15 22:06:50 -07:00
parent 2ead9fa20c
commit 825221f2e5
3 changed files with 9 additions and 5 deletions

View File

@ -2823,6 +2823,12 @@ bool PassBuilder::isAnalysisPassName(StringRef PassName) {
#define CGSSC_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define MODULE_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#define FUNCTION_ALIAS_ANALYSIS(NAME, CREATE_PASS) \
if (PassName == NAME) \
return true;
#include "PassRegistry.def"
return false;
}

View File

@ -1,4 +1,5 @@
; RUN: opt < %s -basic-aa -globals-aa -S -licm | FileCheck %s
; RUN: opt < %s -basic-aa -globals-aa -S -licm -enable-new-pm=0 | FileCheck %s
; RUN: opt < %s -basic-aa -globals-aa -S -licm -enable-new-pm=1 | FileCheck %s
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.10.0"

View File

@ -336,15 +336,12 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
}
// 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);
}
}
// For compatibility with the legacy PM AA pipeline.
@ -389,7 +386,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
return false;
}
}
for (auto PassName : NonAAPasses) {
for (auto PassName : Passes) {
std::string ModifiedPassName(PassName.begin(), PassName.end());
if (PB.isAnalysisPassName(PassName))
ModifiedPassName = "require<" + ModifiedPassName + ">";