llvm-project/llvm/test/Transforms/JumpThreading
Sanjoy Das 8b859c26ec [JumpThreading] Re-enable JumpThreading for guards
Summary:
JumpThreading for guards feature has been reverted at https://reviews.llvm.org/rL295200
due to the following problem: the feature used the following algorithm for detection of
diamond patters:

1. Find a block with 2 predecessors;
2. Check that these blocks have a common single parent;
3. Check that the parent's terminator is a branch instruction.

The problem is that these checks are insufficient. They may pass for a non-diamond
construction in case if those two predecessors are actually the same block. This may
happen if parent's terminator is a br (either conditional or unconditional) to a block
that ends with "switch" instruction with exactly two branches going to one block.

This patch re-enables the JumpThreading for guards and fixes this issue by adding the
check that those found predecessors are actually different blocks. This guarantees that
parent's terminator is a conditional branch with exactly 2 different successors, which
is now ensured by assertions. It also adds two more tests for this situation (with parent's
terminator being a conditional and an unconditional branch).

Patch by Max Kazantsev!

Reviewers: anna, sanjoy, reames

Reviewed By: sanjoy

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D30036

llvm-svn: 295410
2017-02-17 04:21:14 +00:00
..
2008-11-27-EntryMunge.ll
2010-08-26-and.ll
2011-04-02-SimplifyDeadBlock.ll
2011-04-14-InfLoop.ll
2012-07-19-NoSuccessorIndirectBr.ll
and-and-cond.ll
and-cond.ll
assume-edge-dom.ll Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
assume.ll Revert @llvm.assume with operator bundles (r289755-r289757) 2016-12-19 08:22:17 +00:00
basic.ll
branch-no-const.ll
compare.ll
conservative-lvi.ll
crash.ll
degenerate-phi.ll
guards.ll [JumpThreading] Re-enable JumpThreading for guards 2017-02-17 04:21:14 +00:00
implied-cond.ll
indirectbr.ll
induction.ll
landing-pad.ll
lvi-load.ll
no-irreducible-loops.ll
or-undef.ll
phi-eq.ll
phi-known.ll
pr9331.ll
pr15851_hang.ll
pr22086.ll
pr26096.ll
pr27840.ll Jump threading: avoid trying to split edge into landingpad block (PR27840) 2016-10-03 18:18:04 +00:00
select.ll
static-profile.ll [JumpThreading] Only write back branch-weight MDs for blocks that originally had PGO info 2016-09-06 16:08:33 +00:00
thread-cmp.ll
thread-loads.ll [JumpThread] Enhance finding partial redundant loads by continuing scanning single predecessor 2017-02-02 15:12:34 +00:00
update-edge-weight.ll