[Mlir-commits] [mlir] [mlir]use correct iterator when eraseOp (PR	#83444)
    Mehdi Amini 
    llvmlistbot at llvm.org
       
    Thu Feb 29 15:53:25 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:
std::set is rarely the right choice in LLVM: https://llvm.org/docs/ProgrammersManual.html#picking-the-right-data-structure-for-a-task
https://github.com/llvm/llvm-project/pull/83444
    
    
More information about the Mlir-commits
mailing list