[PATCH] D42260: [JumpThreading] Don't select an edge that we know we can't thread

Haicheng Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 11:12:08 PDT 2018


haicheng added inline comments.


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1485
   // Find the most popular dest.
   DenseMap<BasicBlock*, unsigned>::iterator DPI = DestPopularity.begin();
   BasicBlock *MostPopularDest = DPI->first;
----------------
I think we need something like

```
if (DestPopularity.empty())
  return nullptr;
```
before this line.

This patch removes some destinations.  If the remaining destinations' conditions are undef, DestPopularity would be empty and we would get a segment fault here.  Without this patch, I don't think the segment fault could happen.


Repository:
  rL LLVM

https://reviews.llvm.org/D42260





More information about the llvm-commits mailing list