summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2009-01-18 06:43:40 +0000
committerMon P Wang <wangmp@apple.com>2009-01-18 06:43:40 +0000
commite9e7abb6b8a95a97ab588bb23d26eabc39117e8d (patch)
treea85a8690012759d46cdb33d21110dfeb84815ae5 /llvm/lib/CodeGen/SelectionDAG
parentb699c9bf5772fba6a1b3cf81e10af8cd98ec7492 (diff)
downloadbcm5719-llvm-e9e7abb6b8a95a97ab588bb23d26eabc39117e8d.tar.gz
bcm5719-llvm-e9e7abb6b8a95a97ab588bb23d26eabc39117e8d.zip
Simplify extract element based on comments from Duncan Sands.
llvm-svn: 62459
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 230079b4205..67a419aac90 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -4880,14 +4880,9 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
// (vextract (scalar_to_vector val, 0) -> val
SDValue InVec = N->getOperand(0);
- SDValue EltNo = N->getOperand(1);
- if (isa<ConstantSDNode>(EltNo)) {
- unsigned Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
- if (InVec.getOpcode() == ISD::SCALAR_TO_VECTOR && Elt == 0) {
- return InVec.getOperand(0);
- }
- }
+ if (InVec.getOpcode() == ISD::SCALAR_TO_VECTOR)
+ return InVec.getOperand(0);
// Perform only after legalization to ensure build_vector / vector_shuffle
// optimizations have already been done.
@@ -4896,6 +4891,7 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) {
// (vextract (v4f32 load $addr), c) -> (f32 load $addr+c*size)
// (vextract (v4f32 s2v (f32 load $addr)), c) -> (f32 load $addr+c*size)
// (vextract (v4f32 shuffle (load $addr), <1,u,u,u>), 0) -> (f32 load $addr)
+ SDValue EltNo = N->getOperand(1);
if (isa<ConstantSDNode>(EltNo)) {
unsigned Elt = cast<ConstantSDNode>(EltNo)->getZExtValue();
OpenPOWER on IntegriCloud