[PATCH] D83596: [BPI] Compile time improvement when erasing blocks (NFC)

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 10 16:56:11 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3e5173dbc352: [BPI] Compile time improvement when erasing blocks (NFC) (authored by tejohnson).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83596/new/

https://reviews.llvm.org/D83596

Files:
  llvm/lib/Analysis/BranchProbabilityInfo.cpp


Index: llvm/lib/Analysis/BranchProbabilityInfo.cpp
===================================================================
--- llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -1056,10 +1056,10 @@
 }
 
 void BranchProbabilityInfo::eraseBlock(const BasicBlock *BB) {
-  for (auto I = Probs.begin(), E = Probs.end(); I != E; ++I) {
-    auto Key = I->first;
-    if (Key.first == BB)
-      Probs.erase(Key);
+  for (const_succ_iterator I = succ_begin(BB), E = succ_end(BB); I != E; ++I) {
+    auto MapI = Probs.find(std::make_pair(BB, I.getSuccessorIndex()));
+    if (MapI != Probs.end())
+      Probs.erase(MapI);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83596.277172.patch
Type: text/x-patch
Size: 668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200710/afe443d4/attachment.bin>


More information about the llvm-commits mailing list