[PATCH] D28380: [SelectionDAG] Handle inverted conditions when splitting into multiple branches.

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 14:24:17 PST 2017


gberry created this revision.
gberry added reviewers: bogner, MatzeB, qcolombet.
gberry added subscribers: sebpop, hiraditya, llvm-commits.
Herald added a subscriber: mcrosier.

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


https://reviews.llvm.org/D28380

Files:
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
  test/CodeGen/AArch64/br-cond-not-merge.ll
  test/CodeGen/X86/cmov.ll
  test/CodeGen/X86/dagcombine-and-setcc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28380.83306.patch
Type: text/x-patch
Size: 9924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170105/f12fb808/attachment.bin>


More information about the llvm-commits mailing list