diff options
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 19 | 
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 4d1e39359ba..7eeb1003599 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -208,6 +208,7 @@ namespace {      SDOperand visitBRCOND(SDNode *N);      SDOperand visitBR_CC(SDNode *N);      SDOperand visitLOAD(SDNode *N); +    SDOperand visitXEXTLOAD(SDNode *N);      SDOperand visitSTORE(SDNode *N);      SDOperand visitINSERT_VECTOR_ELT(SDNode *N);      SDOperand visitVINSERT_VECTOR_ELT(SDNode *N); @@ -643,6 +644,9 @@ SDOperand DAGCombiner::visit(SDNode *N) {    case ISD::BRCOND:             return visitBRCOND(N);    case ISD::BR_CC:              return visitBR_CC(N);    case ISD::LOAD:               return visitLOAD(N); +  case ISD::EXTLOAD: +  case ISD::SEXTLOAD: +  case ISD::ZEXTLOAD:           return visitXEXTLOAD(N);    case ISD::STORE:              return visitSTORE(N);    case ISD::INSERT_VECTOR_ELT:  return visitINSERT_VECTOR_ELT(N);    case ISD::VINSERT_VECTOR_ELT: return visitVINSERT_VECTOR_ELT(N); @@ -2278,6 +2282,21 @@ SDOperand DAGCombiner::visitLOAD(SDNode *N) {    return SDOperand();  } +/// visitXEXTLOAD - Handle EXTLOAD/ZEXTLOAD/SEXTLOAD. +SDOperand DAGCombiner::visitXEXTLOAD(SDNode *N) { +  SDOperand Chain    = N->getOperand(0); +  SDOperand Ptr      = N->getOperand(1); +  SDOperand SrcValue = N->getOperand(2); +  SDOperand EVT      = N->getOperand(3); +   +  // If there are no uses of the loaded value, change uses of the chain value +  // into uses of the chain input (i.e. delete the dead load). +  if (N->hasNUsesOfValue(0, 0)) +    return CombineTo(N, DAG.getNode(ISD::UNDEF, N->getValueType(0)), Chain); +   +  return SDOperand(); +} +  SDOperand DAGCombiner::visitSTORE(SDNode *N) {    SDOperand Chain    = N->getOperand(0);    SDOperand Value    = N->getOperand(1);  | 

