diff options
author | Juergen Ributzka <juergen@apple.com> | 2014-01-13 20:51:35 +0000 |
---|---|---|
committer | Juergen Ributzka <juergen@apple.com> | 2014-01-13 20:51:35 +0000 |
commit | 7384405f2331f15e29d5c72122b14261ca6cbe5b (patch) | |
tree | 35bd691d08575b823a4121fe587699dcd83ff525 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | fc4a4e4e519f7493bc37f684fd61642ab54a28df (diff) | |
download | bcm5719-llvm-7384405f2331f15e29d5c72122b14261ca6cbe5b.tar.gz bcm5719-llvm-7384405f2331f15e29d5c72122b14261ca6cbe5b.zip |
[DAG] Teach DAG to also reassociate vector operations
This commit teaches DAG to reassociate vector ops, which in turn enables
constant folding of vector op chains that appear later on during custom lowering
and DAG combine.
Reviewed by Andrea Di Biagio
llvm-svn: 199135
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 8a1dfdc39e2..e003caeddb1 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -6533,6 +6533,15 @@ bool BuildVectorSDNode::isConstantSplat(APInt &SplatValue, return true; } +bool BuildVectorSDNode::isConstant() const { + for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { + unsigned Opc = getOperand(i).getOpcode(); + if (Opc != ISD::UNDEF && Opc != ISD::Constant && Opc != ISD::ConstantFP) + return false; + } + return true; +} + bool ShuffleVectorSDNode::isSplatMask(const int *Mask, EVT VT) { // Find the first non-undef value in the shuffle mask. unsigned i, e; |