[llvm] da43d42 - [NPM][opt] Disallow -analyze under NPM

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 21 20:19:22 PDT 2020


Author: Arthur Eubanks
Date: 2020-10-21T20:18:48-07:00
New Revision: da43d428d03823770b2520792044fa88777b4dcf

URL: https://github.com/llvm/llvm-project/commit/da43d428d03823770b2520792044fa88777b4dcf
DIFF: https://github.com/llvm/llvm-project/commit/da43d428d03823770b2520792044fa88777b4dcf.diff

LOG: [NPM][opt] Disallow -analyze under NPM

-analyze does not work with the NPM.
'print<foo>' passes should be used instead.

Added: 
    

Modified: 
    llvm/test/Other/2007-06-05-PassID.ll
    llvm/tools/opt/opt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/Other/2007-06-05-PassID.ll b/llvm/test/Other/2007-06-05-PassID.ll
index 6964f2824d68..a219fa740ff4 100644
--- a/llvm/test/Other/2007-06-05-PassID.ll
+++ b/llvm/test/Other/2007-06-05-PassID.ll
@@ -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 \

diff  --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 37fb271824e9..8c25c284c872 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -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;


        


More information about the llvm-commits mailing list