]> granicus.if.org Git - llvm/commit
StructurizeCFG: Directly invert cmp instructions
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 19 Apr 2017 18:29:07 +0000 (18:29 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Wed, 19 Apr 2017 18:29:07 +0000 (18:29 +0000)
commitfe6b2045f8266b57a25cfa6d91bf9a5fef92e1cc
tree797c6c0ac0a4a800533359a16a6c0f2e54efa34a
parent980a21c3065fc109cec5958f09b7655f6857bc1f
StructurizeCFG: Directly invert cmp instructions

The most common case for a branch condition is
a single use compare. Directly invert the branch
predicate rather than adding a lot of xor i1 true
which the DAG will have to fold later.

This produces nicer to read structurizer output.

This produces some random changes in codegen
due to the DAG swapping branch conditions itself,
and then does a poor job of dealing with those
inverts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300732 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/StructurizeCFG.cpp
test/CodeGen/AMDGPU/loop_break.ll
test/CodeGen/AMDGPU/multi-divergent-exit-region.ll
test/CodeGen/AMDGPU/nested-loop-conditions.ll
test/CodeGen/AMDGPU/ret_jump.ll
test/Transforms/StructurizeCFG/invert-compare.ll [new file with mode: 0644]
test/Transforms/StructurizeCFG/one-loop-multiple-backedges.ll
test/Transforms/StructurizeCFG/post-order-traversal-bug.ll