[Mlir-commits] [mlir] [mlir]use correct iterator when eraseOp (PR #83444)
Mehdi Amini
llvmlistbot at llvm.org
Thu Feb 29 15:54:52 PST 2024
================
@@ -229,7 +229,10 @@ void RewriterBase::eraseOp(Operation *op) {
// until the region is empty. (The block graph could be disconnected.)
while (!r.empty()) {
SmallVector<Block *> erasedBlocks;
- for (Block *b : llvm::post_order(&r.front())) {
+ // Some blocks may have invalid successor, use a set including nullptr
+ // to avoid null pointer.
+ std::set<Block *> visited{nullptr};
----------------
joker-eph wrote:
The post-order iterator template defaults to SmallPtrSet
https://github.com/llvm/llvm-project/pull/83444
More information about the Mlir-commits
mailing list