[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
This commit is contained in:
Tres Popp 2020-10-09 15:37:42 +02:00
parent 8a836daaa9
commit 46dd827232
1 changed files with 6 additions and 6 deletions

View File

@ -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);
}
}];
}