[llvm] [Codegen] (NFC) Faster algorithm for MachineBlockPlacement (PR #91843)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 17:40:22 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);
----------------
weiguozhi wrote:

PrevUnplacedBlockInFilterIt becomes invalidated after this statement, even you don't increment it immediately, you still want to use it in getFirstUnplacedBlock later.

https://github.com/llvm/llvm-project/pull/91843


More information about the llvm-commits mailing list