]> granicus.if.org Git - llvm/commitdiff
CodeGen: BlockPlacement: Add comment about DenseMap Safety.
authorKyle Butt <kyle+llvm@iteratee.net>
Wed, 12 Apr 2017 18:30:32 +0000 (18:30 +0000)
committerKyle Butt <kyle+llvm@iteratee.net>
Wed, 12 Apr 2017 18:30:32 +0000 (18:30 +0000)
The use of a DenseMap in precomputeTriangleChains does not cause
non-determinism, even though it is iterated over, as the only thing the
iteration does is to insert entries into a new DenseMap, which is not iterated.
Comment only change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300088 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineBlockPlacement.cpp

index e23f90be40992d8b7e1fba0dd0f5635a887d58a4..4cfc128a8c1d61460c686feca130ad79299713b2 100644 (file)
@@ -1165,6 +1165,9 @@ void MachineBlockPlacement::precomputeTriangleChains() {
     }
   }
 
+  // Iterating over a DenseMap is safe here, because the only thing in the body
+  // of the loop is inserting into another DenseMap (ComputedEdges).
+  // ComputedEdges is never iterated, so this doesn't lead to non-determinism.
   for (auto &ChainPair : TriangleChainMap) {
     TriangleChain &Chain = ChainPair.second;
     // Benchmarking has shown that due to branch correlation duplicating 2 or