virtual Operation *findReplacementOp(Operation *op,
ValueRange newValues) const;
+ /// Notify the listener that the pattern failed to match the given operation,
+ /// and provide a callback to populate a diagnostic with the reason why the
+ /// failure occurred.
+ LogicalResult
+ notifyMatchFailure(Location loc,
+ function_ref<void(Diagnostic &)> reasonCallback) override;
+
/// This function is called when a tracked payload op is dropped because no
/// replacement op was found. Derived classes can implement this function for
/// custom error handling.
return it->second.contains(op);
}
+LogicalResult transform::TrackingListener::notifyMatchFailure(
+ Location loc, function_ref<void(Diagnostic &)> reasonCallback) {
+ LLVM_DEBUG({
+ Diagnostic diag(loc, DiagnosticSeverity::Remark);
+ reasonCallback(diag);
+ DBGS() << "Match Failure : " << diag.str() << "\n";
+ });
+ return failure();
+}
+
void transform::TrackingListener::notifyOperationInserted(Operation *op) {
newOps[op->getName()].insert(op);
}