]> granicus.if.org Git - llvm/commit
[SelectionDAG] Handle inverted conditions when splitting into multiple branches.
authorGeoff Berry <gberry@codeaurora.org>
Tue, 24 Jan 2017 16:36:07 +0000 (16:36 +0000)
committerGeoff Berry <gberry@codeaurora.org>
Tue, 24 Jan 2017 16:36:07 +0000 (16:36 +0000)
commit597b7758611f45538396de2cc03ed55e36091faf
tree378358456d15811a7af5b6580cb6106487e28105
parenta9970f0c85ee08724690f2ea1bedbadca12d3b17
[SelectionDAG] Handle inverted conditions when splitting into multiple branches.

Summary:
When conditional branches with complex conditions are split into
multiple branches in SelectionDAGBuilder::FindMergedConditions, also
handle inverted conditions.  These may sometimes appear without having
been optimized by InstCombine when CodeGenPrepare decides to sink and
duplicate cmp instructions, causing them to have only one use.  This
problem can be increased by e.g. GVNHoist hiding more cmps from
InstCombine by combining equivalent cmps from different blocks.

For example codegen X & !(Y | Z) as:
    jmp_if_X TmpBB
    jmp FBB
  TmpBB:
    jmp_if_notY Tmp2BB
    jmp FBB
  Tmp2BB:
    jmp_if_notZ TBB
    jmp FBB

Reviewers: bogner, MatzeB, qcolombet

Subscribers: llvm-commits, hiraditya, mcrosier, sebpop

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292944 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
test/CodeGen/AArch64/br-cond-not-merge.ll [new file with mode: 0644]
test/CodeGen/X86/cmov.ll
test/CodeGen/X86/dagcombine-and-setcc.ll