[PATCH] D30869: [JumpThread] In case all predecessor go to a single successor of current BB. We want to fold (not thread).

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 11 17:23:26 PST 2017


trentxintong added inline comments.


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1273
+    if (PredToDestList.size() ==
+        (unsigned)std::distance(pred_begin(BB), pred_end(BB))) {
+      for (auto *SuccBB : make_range(succ_begin(BB), succ_end(BB))) {
----------------
dberlin wrote:
> majnemer wrote:
> > I'd use `size_t` instead of `unsigned` here.
> If you are going to check predecessors a bunch, please use the prediteratorcache to cache the size.
> This is not a cheap operation.
> 
I think thats a good suggestion. There are a few places we get the predecessors of the block currently being processed, we could use a PredIterCache for them. But I prefer to put it in as another commit.


https://reviews.llvm.org/D30869





More information about the llvm-commits mailing list