[SelectionDAG] Unary vector constant folding integer legality fixes
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 1 May 2015 08:20:04 +0000 (08:20 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 1 May 2015 08:20:04 +0000 (08:20 +0000)
commit509fb2c84c5b1cbff85c5963d5a112dd157e91ad
tree936e7a1eb5cf59f63a9fdd81657a7ce2c9aef7c5
parentf17a95a6810dc4c15e3e06ed988155d315b31a91
[SelectionDAG] Unary vector constant folding integer legality fixes

This patch fixes issues with vector constant folding not correctly handling scalar input operands if they require implicit truncation - this was tested with llvm-stress as recommended by Patrik H Hagglund.

The patch ensures that integer input scalars from a build vector are correctly truncated before folding, and that constant integer scalar results are promoted to a legal type before inclusion in the new folded build vector.

I have added another crash test case and also a test for UINT_TO_FP / SINT_TO_FP using an non-truncated scalar input, which was failing before this patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236308 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
test/CodeGen/X86/fold-vector-bv-crash.ll [new file with mode: 0644]
test/CodeGen/X86/fold-vector-trunc-sitofp.ll [new file with mode: 0644]