[llvm] [CodeGen] Restore MachineBlockPlacement block ordering (PR #99351)

William Junda Huang via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 12:35:09 PDT 2024


================
@@ -2627,7 +2635,12 @@ MachineBlockPlacement::collectLoopBlockSet(const MachineLoop &L) {
   } else
     LoopBlockSet.insert(L.block_begin(), L.block_end());
 
-  return LoopBlockSet;
+  // Copy the blocks into a BlockFilterSet, as iterating it is faster than
+  // std::set. We will only remove blocks and never insert them, which will
+  // preserve the ordering.
+  BlockFilterSet Ret;
+  Ret.insert(LoopBlockSet.begin(), LoopBlockSet.end());
----------------
huangjd wrote:

Just use the constructor that takes begin and end iterators.

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


More information about the llvm-commits mailing list