Skip to content

Commit df0b893

Browse files
committed
[opt] Remove -analyze option
This is legacy PM-specific, which is deprecated. Uses of this should be replaced with a corresponding `-passes='print<foo>'`. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D122420
1 parent cf9c606 commit df0b893

File tree

6 files changed

+3
-297
lines changed

6 files changed

+3
-297
lines changed

llvm/tools/opt/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ add_llvm_tool(opt
3232
BreakpointPrinter.cpp
3333
GraphPrinters.cpp
3434
NewPMDriver.cpp
35-
PassPrinters.cpp
3635
PrintSCC.cpp
3736
opt.cpp
3837

llvm/tools/opt/NewPMDriver.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "NewPMDriver.h"
16-
#include "PassPrinters.h"
1716
#include "llvm/ADT/SmallVector.h"
1817
#include "llvm/ADT/StringRef.h"
1918
#include "llvm/Analysis/AliasAnalysis.h"

llvm/tools/opt/PassPrinters.cpp

Lines changed: 0 additions & 212 deletions
This file was deleted.

llvm/tools/opt/PassPrinters.h

Lines changed: 0 additions & 40 deletions
This file was deleted.

llvm/tools/opt/opt.cpp

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
#include "BreakpointPrinter.h"
1515
#include "NewPMDriver.h"
16-
#include "PassPrinters.h"
1716
#include "llvm/ADT/Triple.h"
1817
#include "llvm/Analysis/CallGraph.h"
1918
#include "llvm/Analysis/CallGraphSCCPass.h"
@@ -199,10 +198,6 @@ DisableBuiltins("disable-builtin",
199198
cl::desc("Disable specific target library builtin function"),
200199
cl::ZeroOrMore);
201200

202-
static cl::opt<bool>
203-
AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization. "
204-
"Legacy pass manager only."));
205-
206201
static cl::opt<bool> EnableDebugify(
207202
"enable-debugify",
208203
cl::desc(
@@ -603,11 +598,6 @@ int main(int argc, char **argv) {
603598

604599
LLVMContext Context;
605600

606-
if (AnalyzeOnly && NoOutput) {
607-
errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
608-
return 1;
609-
}
610-
611601
// If `-passes=` is specified, use NPM.
612602
// If `-enable-new-pm` is specified and there are no codegen passes, use NPM.
613603
// e.g. `-enable-new-pm -sroa` will use NPM.
@@ -756,7 +746,7 @@ int main(int argc, char **argv) {
756746
// If the output is set to be emitted to standard out, and standard out is a
757747
// console, print out a warning message and refuse to do it. We don't
758748
// impress anyone by spewing tons of binary goo to a terminal.
759-
if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
749+
if (!Force && !NoOutput && !OutputAssembly)
760750
if (CheckBitcodeOutputToConsole(Out->os()))
761751
NoOutput = true;
762752

@@ -783,13 +773,6 @@ int main(int argc, char **argv) {
783773
}
784774

785775
if (UseNPM) {
786-
if (AnalyzeOnly) {
787-
errs() << "Cannot specify -analyze under new pass manager, either "
788-
"specify '-enable-new-pm=0', or use the corresponding new pass "
789-
"manager pass, e.g. '-passes=print<scalar-evolution>'. For a "
790-
"full list of passes, see the '--print-passes' flag.\n";
791-
return 1;
792-
}
793776
if (legacy::debugPassSpecified()) {
794777
errs()
795778
<< "-debug-pass does not work with the new PM, either use "
@@ -963,30 +946,8 @@ int main(int argc, char **argv) {
963946
else
964947
errs() << argv[0] << ": cannot create pass: "
965948
<< PassInf->getPassName() << "\n";
966-
if (P) {
967-
PassKind Kind = P->getPassKind();
949+
if (P)
968950
addPass(Passes, P);
969-
970-
if (AnalyzeOnly) {
971-
switch (Kind) {
972-
case PT_Region:
973-
Passes.add(createRegionPassPrinter(PassInf, Out->os()));
974-
break;
975-
case PT_Loop:
976-
Passes.add(createLoopPassPrinter(PassInf, Out->os()));
977-
break;
978-
case PT_Function:
979-
Passes.add(createFunctionPassPrinter(PassInf, Out->os()));
980-
break;
981-
case PT_CallGraphSCC:
982-
Passes.add(createCallGraphPassPrinter(PassInf, Out->os()));
983-
break;
984-
default:
985-
Passes.add(createModulePassPrinter(PassInf, Out->os()));
986-
break;
987-
}
988-
}
989-
}
990951
}
991952

992953
if (OptLevelO0)
@@ -1039,7 +1000,7 @@ int main(int argc, char **argv) {
10391000
std::unique_ptr<raw_svector_ostream> BOS;
10401001
raw_ostream *OS = nullptr;
10411002

1042-
const bool ShouldEmitOutput = !NoOutput && !AnalyzeOnly;
1003+
const bool ShouldEmitOutput = !NoOutput;
10431004

10441005
// Write bitcode or assembly to the output as the last step...
10451006
if (ShouldEmitOutput || RunTwice) {

llvm/utils/gn/secondary/llvm/tools/opt/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ executable("opt") {
2424
"BreakpointPrinter.cpp",
2525
"GraphPrinters.cpp",
2626
"NewPMDriver.cpp",
27-
"PassPrinters.cpp",
2827
"PrintSCC.cpp",
2928
"opt.cpp",
3029
]

0 commit comments

Comments
 (0)