[PATCH] D20957: [JumpThreading] Prevent dangling pointer problems in BranchProbabilityInfo

Igor Laevsky via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 08:18:31 PDT 2016


igor-laevsky added reviewers: dnovillo, congh.
igor-laevsky marked an inline comment as done.

================
Comment at: lib/Analysis/BranchProbabilityInfo.cpp:644
@@ +643,3 @@
+  for (auto I = Probs.begin(), E = Probs.end(); I != E; ++I) {
+    auto Key = I->first;
+    if (Key.first == BB)
----------------
sanjoy wrote:
> I see, but I'm not sure that this won't be a compile time regression.  Maybe @dnovillo or @congh (names that show up on git-blame) will have an idea?
Yes, compile time might be an issue here. It would be possible to avoid linear search by changing data type of the branch probability storage from:
  DenseMap<pair<BasicBlock*, unsigned>, BranchProbability> Probs;
into:
  DenseMap<BasicBlock*, IndexedMap<unsigned>> Probs;

However it would be fairly large change and I don't wont to mix it with this one. Does it sound reasonable if I will submit this version first and then follow up with a data type change?


http://reviews.llvm.org/D20957





More information about the llvm-commits mailing list