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

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 12:15:24 PDT 2016


sanjoy added inline comments.

================
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)
----------------
igor-laevsky wrote:
> 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?
Right, other than that issue, this lgtm; but I'd prefer waiting till someone more familiar with this code has had time to chime in about the potential compile time problems.


http://reviews.llvm.org/D20957





More information about the llvm-commits mailing list