Skip to content

Commit 7b06786

Browse files
committed
Fix Block::eraseArguments to properly update the cached positions
This is fixing correctness and ASAN failure post-ee90bb3486948.
1 parent a6d76cf commit 7b06786

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mlir/lib/IR/Block.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,8 @@ void Block::eraseArguments(llvm::BitVector eraseIndices) {
200200
}
201201
}
202202
// Update the cached position for the arguments after the first erased one.
203-
int64_t index = 0;
204-
for (BlockArgument arg :
205-
llvm::drop_begin(arguments, eraseIndices.find_first()))
203+
int64_t index = eraseIndices.find_first();
204+
for (BlockArgument arg : llvm::drop_begin(arguments, index))
206205
arg.setArgNumber(index++);
207206
}
208207

0 commit comments

Comments
 (0)