OSDN Git Service

[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)
commit91b5ad4eb5d2c6af50e07040f263d152766dcbb0
tree438fa75c84c5c7f64143d5390dc627fc96aff255
parent4945c5367f4ffb648818529eab53a1ad01b8461f
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269728 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/icmp-vec.ll