[DAGCOmbine] Ensure that (brcond (setcc ...)) is handled in a canonical manner.
authorAmaury Sechet <deadalnix@gmail.com>
Fri, 23 Feb 2018 11:50:42 +0000 (11:50 +0000)
committerAmaury Sechet <deadalnix@gmail.com>
Fri, 23 Feb 2018 11:50:42 +0000 (11:50 +0000)
commit893a6b89ffe0c247f2df02497f01e07970f2f51c
treefd9b5e7bb4cafb0e9579ac81799d074d717f1627
parentc10570f7c6ab7424edbc6e6e7c8b7cb69730d991
[DAGCOmbine] Ensure that (brcond (setcc ...)) is handled in a canonical manner.

Summary:
There are transformation that change setcc into other constructs, and transform that try to reconstruct a setcc from the brcond condition. Depending on what order these transform are done, the end result differs.

Most of the time, it is preferable to get a setcc as a brcond argument (and this is why brcond try to recreate the setcc in the first place) so we ensure this is done every time by also doing it at the setcc level when the only user is a brcond.

Reviewers: spatel, hfinkel, niravd, craig.topper

Subscribers: nhaehnle, llvm-commits

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

llvm-svn: 325892
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/Hexagon/HexagonPatterns.td
llvm/test/CodeGen/AMDGPU/cndmask-no-def-vcc.ll
llvm/test/CodeGen/AMDGPU/setcc.ll
llvm/test/CodeGen/X86/and-sink.ll
llvm/test/CodeGen/X86/fold-rmw-ops.ll
llvm/test/CodeGen/X86/or-branch.ll