[PATCH] D44177: [JumpThreading] use InvalidBlocks to avoid unreachable regions

Brian Rzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 6 15:57:15 PST 2018


brzycki created this revision.
brzycki added reviewers: dberlin, sebpop, kuhar, dinesh.d, rafael.
Herald added a subscriber: hiraditya.

It is possible to cause hangs in JumpThreading due to how the pass decides there is no more work to be done. An older attempt at fixing this problem was https://reviews.llvm.org/D3991 where `removeUnreachableBlocks(F)` is now called on the function before any JumpThreading is attempted. This has a few drawbacks though:

- It's an expensive transformation.
- It is a coarse tool: it does not comprehend or care about preserving Loops.
- It actually has nothing to do the JumpThreading pass.
- It does more than just remove unrechable blocks, it changes reachable blocks too, especially Terminator Instructions.

This patch foregoes calling `removeUnreachableBlocks` and uses a `SmallPtrSet` and our initial `DominatorTree` to track invalid blocks.


Repository:
  rL LLVM

https://reviews.llvm.org/D44177

Files:
  llvm/include/llvm/Transforms/Scalar/JumpThreading.h
  llvm/lib/Transforms/Scalar/JumpThreading.cpp
  llvm/test/Transforms/JumpThreading/pr15851_hang.ll
  llvm/test/Transforms/JumpThreading/select.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44177.137283.patch
Type: text/x-patch
Size: 6925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180306/af9eda6e/attachment.bin>


More information about the llvm-commits mailing list