[PATCH] D30869: [JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor. .
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 18 18:17:13 PDT 2017
sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.
lgtm with nits
================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1294
+ // not thread. By doing so, we do not need to duplicate the current block and
+ // also miss potential opportunities in case we dont/cant duplicate.
+ if (OnlyDest && OnlyDest != MultipleDestSentinel) {
----------------
s/dont/don't
s/cant/can't
================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1299
+ for (BasicBlock *SuccBB : successors(BB)) {
+ if (SuccBB == OnlyDest)
+ continue;
----------------
In this case, it may be cleaner to write the loop as:
```
for (BasicBlock *SuccBB : successors(BB))
if (SuccBB != OnlyDest)
SuccBB->removePredecessor(BB, true); // Unreachable successor
```
https://reviews.llvm.org/D30869
More information about the llvm-commits
mailing list