[PATCH] D48181: [JumpThreading] Ignore nil destionation when determining whether a block only goes to a single destination

Brian Rzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 22 10:14:44 PDT 2018


brzycki added a comment.

Added small fix to suggested code.



================
Comment at: lib/Transforms/Scalar/JumpThreading.cpp:1608
     if (isa<UndefValue>(Val))
       DestBB = nullptr;
     else if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) {
----------------
brzycki wrote:
> It might be better to add a new counter and increment it here:
> 
> ```
>     if (isa<UndefValue>(Val)) {
>       ++PredWithUndefDest;
>       continue;
>     } else if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) {
> ```
> 
> I dislike that the logic changes below include  `PredWithKnownDest` for undef (unknown) destinations.
You also need to add before the `continue`:

```
PredToDestList.push_back(std::make_pair(Pred, nullptr));
```
inside the `UndefValue` check.


Repository:
  rL LLVM

https://reviews.llvm.org/D48181





More information about the llvm-commits mailing list