[Mlir-commits] [mlir] 7b06786 - Fix Block::eraseArguments to properly update the cached positions

Mehdi Amini llvmlistbot at llvm.org
Sat Feb 27 11:05:21 PST 2021


Author: Mehdi Amini
Date: 2021-02-27T19:04:12Z
New Revision: 7b06786de239a4ab7d53ee8ca0b2f5a9b15a871a

URL: https://github.com/llvm/llvm-project/commit/7b06786de239a4ab7d53ee8ca0b2f5a9b15a871a
DIFF: https://github.com/llvm/llvm-project/commit/7b06786de239a4ab7d53ee8ca0b2f5a9b15a871a.diff

LOG: Fix Block::eraseArguments to properly update the cached positions

This is fixing correctness and ASAN failure post-ee90bb3486948.

Added: 
    

Modified: 
    mlir/lib/IR/Block.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp
index 2ae983d9c51d..0758d1ecb647 100644
--- a/mlir/lib/IR/Block.cpp
+++ b/mlir/lib/IR/Block.cpp
@@ -200,9 +200,8 @@ void Block::eraseArguments(llvm::BitVector eraseIndices) {
     }
   }
   // Update the cached position for the arguments after the first erased one.
-  int64_t index = 0;
-  for (BlockArgument arg :
-       llvm::drop_begin(arguments, eraseIndices.find_first()))
+  int64_t index = eraseIndices.find_first();
+  for (BlockArgument arg : llvm::drop_begin(arguments, index))
     arg.setArgNumber(index++);
 }
 


        


More information about the Mlir-commits mailing list