From 46dd827232e73135eca1b6f05dc5bebdb277c9db Mon Sep 17 00:00:00 2001 From: Tres Popp Date: Fri, 9 Oct 2020 15:37:42 +0200 Subject: [PATCH] [mlir] Forward listeners when utilizing scf::IfOp::get*BodyBuilder. Without this PatternRewriting infrastructure does not know of modifications and cannot properly legalize nor rollback changes. Differential Revision: https://reviews.llvm.org/D89129 --- mlir/include/mlir/Dialect/SCF/SCFOps.td | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mlir/include/mlir/Dialect/SCF/SCFOps.td b/mlir/include/mlir/Dialect/SCF/SCFOps.td index 1011e0d7ef68..d7ff8b6352bb 100644 --- a/mlir/include/mlir/Dialect/SCF/SCFOps.td +++ b/mlir/include/mlir/Dialect/SCF/SCFOps.td @@ -251,15 +251,15 @@ def IfOp : SCF_Op<"if", ]; let extraClassDeclaration = [{ - OpBuilder getThenBodyBuilder() { + OpBuilder getThenBodyBuilder(OpBuilder::Listener *listener = nullptr) { Block* body = getBody(0); - return results().empty() ? OpBuilder::atBlockTerminator(body) - : OpBuilder::atBlockEnd(body); + return results().empty() ? OpBuilder::atBlockTerminator(body, listener) + : OpBuilder::atBlockEnd(body, listener); } - OpBuilder getElseBodyBuilder() { + OpBuilder getElseBodyBuilder(OpBuilder::Listener *listener = nullptr) { Block* body = getBody(1); - return results().empty() ? OpBuilder::atBlockTerminator(body) - : OpBuilder::atBlockEnd(body); + return results().empty() ? OpBuilder::atBlockTerminator(body, listener) + : OpBuilder::atBlockEnd(body, listener); } }]; }