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

David Majnemer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 11 16:15:30 PST 2017


majnemer 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))) {
----------------
I'd use `size_t` instead of `unsigned` here.


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1274
+        (unsigned)std::distance(pred_begin(BB), pred_end(BB))) {
+      for (auto *SuccBB : make_range(succ_begin(BB), succ_end(BB))) {
+        if (SuccBB == OnlyDest)
----------------
This can be `successors(BB)`


================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1288
+      // erase it.
+      Instruction *CondInst = dyn_cast<Instruction>(Cond);
+      if (CondInst && CondInst->use_empty())
----------------
This can be `auto *CondInst`


https://reviews.llvm.org/D30869





More information about the llvm-commits mailing list