[DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)
authorLayton Kifer <laytonkifer@gmail.com>
Sun, 6 Dec 2020 16:50:42 +0000 (11:50 -0500)
committerSanjay Patel <spatel@rotateright.com>
Sun, 6 Dec 2020 16:52:10 +0000 (11:52 -0500)
commitac522f87002ffc20d377e284080c9fa7f63216fc
tree2514318340e42416faa0e65723039111cd188ff1
parent0b3e393d6c8b0f6bb8a13b1a71aba796c87ed239
[DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)

Move fold of (sext (not i1 x)) -> (add (zext i1 x), -1) from X86 to DAGCombiner to improve codegen on other targets.

Differential Revision: https://reviews.llvm.org/D91589
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/AArch64/select_const.ll
llvm/test/CodeGen/ARM/select_const.ll
llvm/test/CodeGen/PowerPC/select_const.ll
llvm/test/CodeGen/RISCV/sext-zext-trunc.ll
llvm/test/CodeGen/SystemZ/sext-zext.ll
llvm/test/CodeGen/X86/pr44140.ll