[InstCombine] check vector elements before trying to transform LE/GE vector icmp...
authorSanjay Patel <spatel@rotateright.com>
Tue, 17 May 2016 00:57:57 +0000 (00:57 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 17 May 2016 00:57:57 +0000 (00:57 +0000)
commite9b2c32e7f0faa0c31c2c1cb44cbe9c9e234cd64
tree5bc4a70bf6e491b86cba60adf8d0bfc92191fa9e
parent4940f87bcc1aa3aa048b3c38c7013d7a385cac4f
[InstCombine] check vector elements before trying to transform LE/GE vector icmp (PR27756)

Fix a bug introduced with rL269426 :
[InstCombine] canonicalize* LE/GE vector integer comparisons to LT/GT (PR26701, PR26819)

We were assuming that a ConstantDataVector / ConstantVector / ConstantAggregateZero operand of
an ICMP was composed of ConstantInt elements, but it might have ConstantExpr or UndefValue
elements. Handle those appropriately.

Also, refactor this function to join the scalar and vector paths and eliminate the switches.

Differential Revision: http://reviews.llvm.org/D20289

llvm-svn: 269728
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-vec.ll