[DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)
authorSanjay Patel <spatel@rotateright.com>
Wed, 26 Apr 2017 20:26:46 +0000 (20:26 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 26 Apr 2017 20:26:46 +0000 (20:26 +0000)
commita0547c3d9f71ae721eab6fb9f2dd4bd2c8d75223
tree5aba469bc6d533368442262979c3fbdac0fb6c61
parent2a906e1b34c39280947a1c9afbf2605c081c4376
[DAGCombiner] add (sext i1 X), 1 --> zext (not i1 X)

Besides better codegen, the motivation is to be able to canonicalize this pattern
in IR (currently we don't) knowing that the backend is prepared for that.

This may also allow removing code for special constant cases in
DAGCombiner::foldSelectOfConstants() that was added in D30180.

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

llvm-svn: 301457
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/ARM/bool-ext-inc.ll
llvm/test/CodeGen/X86/bool-ext-inc.ll