Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/Dialect/Transform/IR/TransformOps.cpp
Show First 20 Lines • Show All 1,037 Lines • ▼ Show 20 Lines | for (Operation &op : body->getOperations()) { | ||||
InFlightDiagnostic diag = | InFlightDiagnostic diag = | ||||
emitOpError() | emitOpError() | ||||
<< "expects only pattern and top-level transform ops in its body"; | << "expects only pattern and top-level transform ops in its body"; | ||||
diag.attachNote(op.getLoc()) << "offending op"; | diag.attachNote(op.getLoc()) << "offending op"; | ||||
return diag; | return diag; | ||||
} | } | ||||
if (auto parent = getOperation()->getParentOfType<WithPDLPatternsOp>()) { | if (auto parent = getOperation()->getParentOfType<WithPDLPatternsOp>()) { | ||||
InFlightDiagnostic diag = emitOpError() << "cannot be nested"; | InFlightDiagnostic diag = emitOpError() << "cannot be nested"; | ||||
ftynse: Nit: expand auto. | |||||
diag.attachNote(parent.getLoc()) << "parent operation"; | diag.attachNote(parent.getLoc()) << "parent operation"; | ||||
return diag; | return diag; | ||||
Why not reporting the error when there is a parent that is possibly a top-level op? WithPDLPatterns is always expected to have one non-pattern child. ftynse: Why not reporting the error when there is a parent that is possibly a top-level op? | |||||
I think it can pass when there is a parent that may be a top-level op from the below test case. But I will fix it. sotoshigoto: I think it can pass when there is a parent that may be a top-level op from the below test case. | |||||
} | } | ||||
if (!topLevelOp) { | |||||
InFlightDiagnostic diag = emitOpError() | |||||
<< "expects at least one non-pattern op"; | |||||
return diag; | |||||
} | |||||
return success(); | return success(); | ||||
} | } | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// PrintOp | // PrintOp | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
void transform::PrintOp::build(OpBuilder &builder, OperationState &result, | void transform::PrintOp::build(OpBuilder &builder, OperationState &result, | ||||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |
Nit: expand auto.