With a function pass manager, it would insert debuginfo metadata before getting to function passes while processing the pass manager, causing debugify to skip while running the function passes. Skip special passes + verifier + printing passes. Compared to the legacy implementation of -debugify-each, this additionally skips verifier passes. Probably no need to update the legacy version since it will be obsolete soon. This fixes 2 instcombine tests using -debugify-each under NPM. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D91558
31 lines
1.0 KiB
C++
31 lines
1.0 KiB
C++
//===- PassInstrumentation.cpp - Pass Instrumentation interface -*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
/// \file
|
|
///
|
|
/// This file provides the implementation of PassInstrumentation class.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/IR/PassInstrumentation.h"
|
|
#include "llvm/ADT/STLExtras.h"
|
|
#include "llvm/IR/PassManager.h"
|
|
|
|
namespace llvm {
|
|
|
|
AnalysisKey PassInstrumentationAnalysis::Key;
|
|
|
|
bool isSpecialPass(StringRef PassID, const std::vector<StringRef> &Specials) {
|
|
size_t Pos = PassID.find('<');
|
|
StringRef Prefix = PassID;
|
|
if (Pos != StringRef::npos)
|
|
Prefix = PassID.substr(0, Pos);
|
|
return any_of(Specials, [Prefix](StringRef S) { return Prefix.endswith(S); });
|
|
}
|
|
|
|
} // namespace llvm
|