[DAGCombiner] don't hoist logic op if operands have other uses
authorSanjay Patel <spatel@rotateright.com>
Thu, 6 Dec 2018 18:16:32 +0000 (18:16 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 6 Dec 2018 18:16:32 +0000 (18:16 +0000)
commitc3717cd0d557ac2df0ce8a58487aacd8a502e69d
tree24611ffa84031f9ae4bd35c5536f012aa52fb62e
parent2a23317e69ee33bc3ffcc22ec92464637ee9fc0a
[DAGCombiner] don't hoist logic op if operands have other uses

The AVX512 diffs are neutral, but the bswap test shows a clear overreach in
hoistLogicOpWithSameOpcodeHands(). If we don't check for other uses, we can
increase the instruction count.

This could also fight with transforms trying to go in the opposite direction
and possibly blow up/infinite loop. This might be enough to solve the bug
noted here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181203/608593.html

I did not add the hasOneUse() checks to all opcodes because I see a perf
regression for at least one opcode. We may decide that's irrelevant in the
face of potential compiler crashing, but I'll see if I can salvage that first.

llvm-svn: 348508
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/avx512-mask-op.ll
llvm/test/CodeGen/X86/avx512-schedule.ll
llvm/test/CodeGen/X86/avx512dq-mask-op.ll
llvm/test/CodeGen/X86/bswap.ll