[DAGCombine] Make sext(setcc) combine respect getBooleanContents
authorMichael Kuperstein <mkuper@google.com>
Mon, 1 Aug 2016 19:39:49 +0000 (19:39 +0000)
committerMichael Kuperstein <mkuper@google.com>
Mon, 1 Aug 2016 19:39:49 +0000 (19:39 +0000)
commitc97da7f3a44c2358cc50737e1567cd69d2abe695
tree86ed76a264f65222d8d0b8ce14a46a94586de7d8
parent8123b966cb7b8dd117b7d0355d2e17b7a47bb911
[DAGCombine] Make sext(setcc) combine respect getBooleanContents

We used to combine "sext(setcc x, y, cc) -> (select (setcc x, y, cc), -1, 0)"
Instead, we should combine to (select (setcc x, y, cc), T, 0) where the value
of T is 1 or -1, depending on the type of the setcc, and getBooleanContents()
for the type if it is not i1.

This fixes PR28504.

llvm-svn: 277371
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/X86/pr28504.ll [new file with mode: 0644]