[NPM][opt] Disallow -analyze under NPM

-analyze does not work with the NPM.
'print<foo>' passes should be used instead.
This commit is contained in:
Arthur Eubanks 2020-10-21 20:17:12 -07:00
parent 5e2c9a05b7
commit da43d428d0
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
;RUN: opt < %s -analyze -dot-cfg-only 2>/dev/null
;RUN: opt < %s -analyze -passes=dot-cfg-only 2>/dev/null
;RUN: opt < %s -passes=dot-cfg-only 2>/dev/null
;RUN: opt < %s -analyze -dot-cfg-only \
;RUN: -cfg-heat-colors=true -cfg-weights=true 2>/dev/null
;RUN: opt < %s -analyze -dot-cfg-only \

View File

@ -753,9 +753,13 @@ int main(int argc, char **argv) {
// but `-enable-new-pm -codegenprepare` will still revert to legacy PM.
if ((EnableNewPassManager && !CodegenPassSpecifiedInPassList()) ||
PassPipeline.getNumOccurrences() > 0) {
if (AnalyzeOnly) {
errs() << "Cannot specify -analyze under new pass manager\n";
return 1;
}
if (PassPipeline.getNumOccurrences() > 0 && PassList.size() > 0) {
errs()
<< "Cannot specify passes via both -foo-pass and --passes=foo-pass";
<< "Cannot specify passes via both -foo-pass and --passes=foo-pass\n";
return 1;
}
SmallVector<StringRef, 4> Passes;