diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -127,7 +127,10 @@ bool use_empty() { return state->use_empty(); } /// Remove this operation from its parent block and delete it. - void erase() { state->erase(); } + void erase() { + state->erase(); + state = nullptr; + } /// Emit an error with the op name prefixed, like "'dim' op " which is /// convenient for verifiers.