summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-05-01 08:53:39 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-05-01 08:53:39 +0000
commitb68343cdd80841ae6b074ba10c09fe3ced5143b3 (patch)
tree52603ef6d531fbe6aa0158df7cd5f2ca67bd761b /llvm/lib
parentb811e951e90f1683f965b4d16ee3f2e22f54560a (diff)
downloadbcm5719-llvm-b68343cdd80841ae6b074ba10c09fe3ced5143b3.tar.gz
bcm5719-llvm-b68343cdd80841ae6b074ba10c09fe3ced5143b3.zip
Forgot about chain result; also UNDEF cannot have multiple values.
llvm-svn: 36622
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 4b57ecfcbcf..5977e88ee13 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3331,19 +3331,19 @@ SDOperand DAGCombiner::visitLOAD(SDNode *N) {
// the updated indexed value in case of indexed loads), change uses of the
// chain value into uses of the chain input (i.e. delete the dead load).
if (!LD->isVolatile()) {
- bool HasUses = false;
- SmallVector<MVT::ValueType, 2> VTs;
- for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {
- if (!N->hasNUsesOfValue(0, i)) {
- HasUses = true;
- break;
+ if (N->getValueType(1) == MVT::Other) {
+ // Unindexed loads.
+ if (N->hasNUsesOfValue(0, 0))
+ return CombineTo(N, DAG.getNode(ISD::UNDEF, N->getValueType(0)), Chain);
+ } else {
+ // Indexed loads.
+ assert(N->getValueType(2) == MVT::Other && "Malformed indexed loads?");
+ if (N->hasNUsesOfValue(0, 0) && N->hasNUsesOfValue(0, 1)) {
+ SDOperand Undef0 = DAG.getNode(ISD::UNDEF, N->getValueType(0));
+ SDOperand Undef1 = DAG.getNode(ISD::UNDEF, N->getValueType(1));
+ SDOperand To[] = { Undef0, Undef1, Chain };
+ return CombineTo(N, To, 3);
}
- VTs.push_back(N->getValueType(i));
- }
- if (!HasUses) {
- SmallVector<SDOperand, 1> Ops;
- return CombineTo(N, DAG.getNode(ISD::UNDEF, &VTs[0], VTs.size(), 0, 0),
- Chain);
}
}
OpenPOWER on IntegriCloud