[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)
commitdf9ce8408a2ca784856032f0a2e32022430e5fec
treecff626959ed38008a0986ffa3ba0101148c0d214
parentd47634d78123c998dd2ae58dbf5ec29ee832b0b4
[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

llvm-svn: 247265
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/aarch64-smax-constantfold.ll [new file with mode: 0644]