[llvm] [Codegen] (NFC) Faster algorithm for MachineBlockPlacement (PR #91843)
William Junda Huang via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 8 18:41:39 PDT 2024
================
@@ -3158,9 +3158,9 @@ bool MachineBlockPlacement::maybeTailDuplicateBlock(
// Handle the filter set
if (BlockFilter) {
- BlockFilter->remove(RemBB);
if (*PrevUnplacedBlockInFilterIt == RemBB)
PrevUnplacedBlockInFilterIt++;
+ BlockFilter->remove(RemBB);
----------------
huangjd wrote:
BlockFilter is a SmallSetVector (which is backed by a small vector) and iterators are tied to the underlying vector (instead of the set), and removing an element shifts following elements one position forward without reallocation so the iterator should be valid (and pointing to the following element if remove happens at or before PrevUnplacedBlockInFilterIt)
https://github.com/llvm/llvm-project/pull/91843
More information about the llvm-commits
mailing list