summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2014-01-08 18:33:04 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2014-01-08 18:33:04 +0000
commit638e97f13512b8424fac28e4ed79964300bcf8b0 (patch)
treeee7bee181c2f2fb7357e7ef5cfdd5fd396083abb /lib
parent2b5313d26ba58fb70b0333a73693ee453315879c (diff)
downloadllvm-638e97f13512b8424fac28e4ed79964300bcf8b0.tar.gz
llvm-638e97f13512b8424fac28e4ed79964300bcf8b0.tar.bz2
llvm-638e97f13512b8424fac28e4ed79964300bcf8b0.tar.xz
Teach the DAGCombiner how to fold 'vselect' dag nodes according
to the following two rules: 1) fold (vselect (build_vector AllOnes), A, B) -> A 2) fold (vselect (build_vector AllZeros), A, B) -> B git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198777 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 8f4da5a567..da9559ee87 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -4402,6 +4402,13 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) {
return DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, Lo, Hi);
}
+ // Fold (vselect (build_vector all_ones), N1, N2) -> N1
+ if (ISD::isBuildVectorAllOnes(N0.getNode()))
+ return N1;
+ // Fold (vselect (build_vector all_zeros), N1, N2) -> N2
+ if (ISD::isBuildVectorAllZeros(N0.getNode()))
+ return N2;
+
return SDValue();
}