Skip to content

Commit 6fb4c9f

Browse files
committed
Revert "Add a breakpoint manager that matches based on File/Line/Col Locations"
This reverts commit d09c805. This is broken on Windows
1 parent 1da0da9 commit 6fb4c9f

File tree

10 files changed

+0
-557
lines changed

10 files changed

+0
-557
lines changed

mlir/include/mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h

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

mlir/include/mlir/Debug/Observers/ActionLogging.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,11 @@ struct ActionLogger : public ExecutionContext::Observer {
3030
bool willExecute) override;
3131
void afterExecute(const ActionActiveStack *action) override;
3232

33-
/// If one of multiple breakpoint managers are set, only actions that are
34-
/// matching a breakpoint will be logged.
35-
void addBreakpointManager(const BreakpointManager *manager) {
36-
breakpointManagers.push_back(manager);
37-
}
38-
3933
private:
40-
/// Check if we should log this action or not.
41-
bool shouldLog(const ActionActiveStack *action);
42-
4334
raw_ostream &os;
4435
bool printActions;
4536
bool printBreakpoints;
4637
bool printIRUnits;
47-
std::vector<const BreakpointManager *> breakpointManagers;
4838
};
4939

5040
} // namespace tracing

mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#ifndef MLIR_TOOLS_MLIROPT_MLIROPTMAIN_H
1414
#define MLIR_TOOLS_MLIROPT_MLIROPTMAIN_H
1515

16-
#include "mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h"
1716
#include "mlir/Support/LogicalResult.h"
1817
#include "llvm/ADT/StringRef.h"
1918

@@ -30,9 +29,6 @@ namespace mlir {
3029
class DialectRegistry;
3130
class PassPipelineCLParser;
3231
class PassManager;
33-
namespace tracing {
34-
class FileLineColLocBreakpointManager;
35-
}
3632

3733
/// Configuration options for the mlir-opt tool.
3834
/// This is intended to help building tools like mlir-opt by collecting the
@@ -86,18 +82,6 @@ class MlirOptMainConfig {
8682
/// Get the filename to use for logging actions.
8783
StringRef getLogActionsTo() const { return logActionsToFlag; }
8884

89-
/// Set a location breakpoint manager to filter out action logging based on
90-
/// the attached IR location in the Action context. Ownership stays with the
91-
/// caller.
92-
void addLogActionLocFilter(tracing::BreakpointManager *breakpointManager) {
93-
logActionLocationFilter.push_back(breakpointManager);
94-
}
95-
96-
/// Get the location breakpoint managers to use to filter out action logging.
97-
ArrayRef<tracing::BreakpointManager *> getLogActionsLocFilters() const {
98-
return logActionLocationFilter;
99-
}
100-
10185
/// Set the callback to populate the pass manager.
10286
MlirOptMainConfig &
10387
setPassPipelineSetupFn(std::function<LogicalResult(PassManager &)> callback) {
@@ -176,9 +160,6 @@ class MlirOptMainConfig {
176160
/// Log action execution to the given file (or "-" for stdout)
177161
std::string logActionsToFlag;
178162

179-
/// Location Breakpoints to filter the action logging.
180-
std::vector<tracing::BreakpointManager *> logActionLocationFilter;
181-
182163
/// The callback to populate the pass manager.
183164
std::function<LogicalResult(PassManager &)> passPipelineCallback;
184165

mlir/lib/Debug/BreakpointManagers/FileLineColLocBreakpointManager.cpp

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

mlir/lib/Debug/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ add_subdirectory(Observers)
33
add_mlir_library(MLIRDebug
44
DebugCounter.cpp
55
ExecutionContext.cpp
6-
BreakpointManagers/FileLineColLocBreakpointManager.cpp
76

87
ADDITIONAL_HEADER_DIRS
98
${MLIR_MAIN_INCLUDE_DIR}/mlir/Debug

mlir/lib/Debug/Observers/ActionLogging.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "mlir/Debug/Observers/ActionLogging.h"
10-
#include "mlir/Debug/BreakpointManager.h"
1110
#include "mlir/IR/Action.h"
1211
#include "llvm/Support/Threading.h"
1312
#include "llvm/Support/raw_ostream.h"
@@ -19,20 +18,8 @@ using namespace mlir::tracing;
1918
// ActionLogger
2019
//===----------------------------------------------------------------------===//
2120

22-
bool ActionLogger::shouldLog(const ActionActiveStack *action) {
23-
// If some condition was set, we ensured it is met before logging.
24-
if (breakpointManagers.empty())
25-
return true;
26-
return llvm::any_of(breakpointManagers,
27-
[&](const BreakpointManager *manager) {
28-
return manager->match(action->getAction());
29-
});
30-
}
31-
3221
void ActionLogger::beforeExecute(const ActionActiveStack *action,
3322
Breakpoint *breakpoint, bool willExecute) {
34-
if (!shouldLog(action))
35-
return;
3623
SmallVector<char> name;
3724
llvm::get_thread_name(name);
3825
if (name.empty()) {
@@ -64,8 +51,6 @@ void ActionLogger::beforeExecute(const ActionActiveStack *action,
6451
}
6552

6653
void ActionLogger::afterExecute(const ActionActiveStack *action) {
67-
if (!shouldLog(action))
68-
return;
6954
SmallVector<char> name;
7055
llvm::get_thread_name(name);
7156
if (name.empty()) {

mlir/lib/Tools/mlir-opt/MlirOptMain.cpp

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "mlir/Tools/ParseUtilities.h"
3333
#include "mlir/Tools/Plugins/DialectPlugin.h"
3434
#include "mlir/Tools/Plugins/PassPlugin.h"
35-
#include "llvm/ADT/StringRef.h"
3635
#include "llvm/Support/CommandLine.h"
3736
#include "llvm/Support/FileUtilities.h"
3837
#include "llvm/Support/InitLLVM.h"
@@ -82,33 +81,6 @@ struct MlirOptMainConfigCLOptions : public MlirOptMainConfig {
8281
" '-' is passed"),
8382
cl::location(logActionsToFlag)};
8483

85-
static cl::list<std::string> logActionLocationFilter(
86-
"log-mlir-actions-filter",
87-
cl::desc(
88-
"Comma separated list of locations to filter actions from logging"),
89-
cl::CommaSeparated,
90-
cl::cb<void, std::string>([&](const std::string &location) {
91-
static bool register_once = [&] {
92-
addLogActionLocFilter(&locBreakpointManager);
93-
return true;
94-
}();
95-
(void)register_once;
96-
static std::vector<std::string> locations;
97-
locations.push_back(location);
98-
StringRef locStr = locations.back();
99-
100-
// Parse the individual location filters and set the breakpoints.
101-
auto diag = [](Twine msg) { llvm::errs() << msg << "\n"; };
102-
auto locBreakpoint =
103-
tracing::FileLineColLocBreakpoint::parseFromString(locStr, diag);
104-
if (failed(locBreakpoint)) {
105-
llvm::errs() << "Invalid location filter: " << locStr << "\n";
106-
exit(1);
107-
}
108-
auto [file, line, col] = *locBreakpoint;
109-
locBreakpointManager.addBreakpoint(file, line, col);
110-
}));
111-
11284
static cl::opt<bool, /*ExternalStorage=*/true> showDialects(
11385
"show-dialects",
11486
cl::desc("Print the list of registered dialects and exit"),
@@ -158,9 +130,6 @@ struct MlirOptMainConfigCLOptions : public MlirOptMainConfig {
158130
/// Pointer to static dialectPlugins variable in constructor, needed by
159131
/// setDialectPluginsCallback(DialectRegistry&).
160132
cl::list<std::string> *dialectPlugins = nullptr;
161-
162-
/// The breakpoint manager for the log action location filter.
163-
tracing::FileLineColLocBreakpointManager locBreakpointManager;
164133
};
165134
} // namespace
166135

@@ -230,8 +199,6 @@ class InstallDebugHandler {
230199
logActionsFile->keep();
231200
raw_fd_ostream &logActionsStream = logActionsFile->os();
232201
actionLogger = std::make_unique<tracing::ActionLogger>(logActionsStream);
233-
for (const auto *locationBreakpoint : config.getLogActionsLocFilters())
234-
actionLogger->addBreakpointManager(locationBreakpoint);
235202

236203
executionContext.registerObserver(actionLogger.get());
237204
context.registerActionHandler(executionContext);
@@ -240,8 +207,6 @@ class InstallDebugHandler {
240207
private:
241208
std::unique_ptr<llvm::ToolOutputFile> logActionsFile;
242209
std::unique_ptr<tracing::ActionLogger> actionLogger;
243-
std::vector<std::unique_ptr<tracing::FileLineColLocBreakpoint>>
244-
locationBreakpoints;
245210
tracing::ExecutionContext executionContext;
246211
};
247212

0 commit comments

Comments
 (0)