[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Evan Cheng evan.cheng at apple.com
Tue May 1 01:53:58 PDT 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.297 -> 1.298
---
Log message:

Forgot about chain result; also UNDEF cannot have multiple values.

---
Diffs of the changes:  (+12 -12)

 DAGCombiner.cpp |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.297 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.298
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.297	Mon Apr 30 19:38:21 2007
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Tue May  1 03:53:39 2007
@@ -3331,19 +3331,19 @@
   // 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);
     }
   }
   






More information about the llvm-commits mailing list