[SelectionDAG] Add common vector constant folding helper function
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 12 Oct 2015 23:00:11 +0000 (23:00 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 12 Oct 2015 23:00:11 +0000 (23:00 +0000)
commitadd7bcf9ae656f3c1e2c5adb4987c541cb95e373
treed2b1036c4a5662ec5fd5fa8a18d4bb752349c47b
parent062054e5caa88d31ff93a21bf418d1e8d232cce3
[SelectionDAG] Add common vector constant folding helper function

We have a number of functions that implement constant folding of vectors (unary and binary ops) in near identical manners (and the differences don't appear to be critical).

This patch introduces a common implementation (SelectionDAG::FoldConstantVectorArithmetic) and calls this in both the unary and binary op cases.

After this initial patch I intend to begin enabling vector constant folding for a wider number of opcodes in SelectionDAG::getNode().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250118 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp