Skip to content

Commit 69cf735

Browse files
committed
[NewPM] Don't error when there's an unrecognized pass name
This currently blocks --print-before/after with a legacy PM pass, for example when we use the new PM for the optimization pipeline but the legacy PM for the codegen pipeline. Also in the future when the codegen pipeline works with the new PM there will be multiple places to specify passes, so even when everything is using the new PM, there will still be multiple places that can accept different pass names. Reviewed By: hoy, ychen Differential Revision: https://reviews.llvm.org/D94283
1 parent 0ebc1fb commit 69cf735

File tree

4 files changed

+2
-20
lines changed

4 files changed

+2
-20
lines changed

llvm/include/llvm/IR/PassInstrumentation.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ class PassInstrumentationCallbacks {
127127
void addClassToPassName(StringRef ClassName, StringRef PassName);
128128
/// Get the pass name for a given pass class name.
129129
StringRef getPassNameForClassName(StringRef ClassName);
130-
/// Whether or not the class to pass name map contains the pass name.
131-
bool hasPassName(StringRef PassName);
132130

133131
private:
134132
friend class PassInstrumentation;

llvm/lib/IR/PassInstrumentation.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ void PassInstrumentationCallbacks::addClassToPassName(StringRef ClassName,
2222
ClassToPassName[ClassName] = PassName.str();
2323
}
2424

25-
bool PassInstrumentationCallbacks::hasPassName(StringRef PassName) {
26-
for (const auto &E : ClassToPassName) {
27-
if (E.getValue() == PassName)
28-
return true;
29-
}
30-
return false;
31-
}
32-
3325
StringRef
3426
PassInstrumentationCallbacks::getPassNameForClassName(StringRef ClassName) {
3527
return ClassToPassName[ClassName];

llvm/lib/Passes/PassBuilder.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -459,14 +459,6 @@ PassBuilder::PassBuilder(bool DebugLogging, TargetMachine *TM,
459459
#define CGSCC_ANALYSIS(NAME, CREATE_PASS) \
460460
PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
461461
#include "PassRegistry.def"
462-
for (const auto &P : printBeforePasses()) {
463-
if (!PIC->hasPassName(P))
464-
report_fatal_error("unrecognized pass name: " + P);
465-
}
466-
for (const auto &P : printAfterPasses()) {
467-
if (!PIC->hasPassName(P))
468-
report_fatal_error("unrecognized pass name: " + P);
469-
}
470462
}
471463
}
472464

llvm/test/Other/print-before-after.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
; RUN: not --crash opt < %s -disable-output -passes='no-op-module' -print-before=bleh 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
2-
; RUN: not --crash opt < %s -disable-output -passes='no-op-module' -print-after=bleh 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
1+
; RUN: opt < %s -disable-output -passes='no-op-module' -print-before=bleh 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
2+
; RUN: opt < %s -disable-output -passes='no-op-module' -print-after=bleh 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
33
; RUN: opt < %s -disable-output -passes='no-op-module' -print-before=no-op-function 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
44
; RUN: opt < %s -disable-output -passes='no-op-module' -print-after=no-op-function 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
55
; RUN: opt < %s -disable-output -passes='no-op-module,no-op-function' -print-before=no-op-module 2>&1 | FileCheck %s --check-prefix=ONCE

0 commit comments

Comments
 (0)