I have a question about when it is okay to modify a parent block/operation in an
Documentation here says an operation pass “must not modify any state referenced or relied upon outside the current operation being operated on. This includes adding or removing operations from the parent block”.
But I can see some mlir algebraic simplification rewrite rules do indeed add operations to the rewritten operation’s parent block (in this case,
POWIStrengthReduction::matchAndRewrite will rewrite the
PowIOpTy with perhaps several multiplication and division operations). Wouldn’t this be a case of adding or removing operations from the parent block?
Also, I see that
RewriterBase::startRootUpdate is not used here, even though the original PowIOp is replaced in place. In what situations must
RewriterBase::startRootUpdate be used?