[DAGCombine] Truncate BUILD_VECTOR operators if necessary when constant folding vectors
authorSilviu Baranga <silviu.baranga@arm.com>
Thu, 10 Sep 2015 10:34:34 +0000 (10:34 +0000)
committerSilviu Baranga <silviu.baranga@arm.com>
Thu, 10 Sep 2015 10:34:34 +0000 (10:34 +0000)
commit040f4f687d64cba1ea5d77675a24bcba8d212a12
treec37441562186833641282979f39307bfc42f8859
parent037cfdbe31069696574cfaac906f7bc59b5ac5bc
[DAGCombine] Truncate BUILD_VECTOR operators if necessary when constant folding vectors

Summary:
The BUILD_VECTOR node will truncate its operators to match the
type. We need to take this into account when constant folding -
we need to perform a truncation before constant folding the elements.
This is because the upper bits can change the result, depending on
the operation type (for example this is the case for min/max).

This change also adds a regression test.

Reviewers: jmolloy

Subscribers: jmolloy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247265 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/aarch64-smax-constantfold.ll [new file with mode: 0644]