]> granicus.if.org Git - llvm/commit
[X86] Fix wrong target specific combine on SETCC nodes.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 12 Mar 2015 15:16:58 +0000 (15:16 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 12 Mar 2015 15:16:58 +0000 (15:16 +0000)
commitbe9322ae7c4f38082e35b60ab45bc9a15e11186b
treee9cdf1ca702138abe5bb4d63ccdd1a2f20635406
parentb4c1547749853c584a1988069f8c3e9d594475c7
[X86] Fix wrong target specific combine on SETCC nodes.

Part of the folding logic implemented by function 'PerformISDSETCCCombine'
only worked under the assumption that the condition code in input could have
been either SETNE or SETEQ.
Unfortunately that assumption was incorrect, and in some cases the algorithm
ended up incorrectly folding SETCC nodes.

The incorrect folding only affected SETCC dag nodes where:
 - one of the operands was a build_vector of all zeroes;
 - the other operand was a SIGN_EXTEND from a vector of MVT:i1 elements;
 - the condition code was neither SETNE nor SETEQ.

Example:
  (setcc (v4i32 (sign_extend v4i1:%A)), (v4i32 VectorOfAllZeroes), setge)

Before this patch, the entire dag node sequence from the example was
incorrectly folded to node %A.

With this patch, the dag node sequence is folded to a
  (xor %A, (v4i1 VectorOfAllOnes)).

Added test setcc-combine.ll.

Thanks to Greg Bedwell for spotting this issue.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232046 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/setcc-combine.ll [new file with mode: 0644]