Make it work for DAG combine of multi-value nodes.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 21 Sep 2006 19:04:05 +0000 (19:04 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 21 Sep 2006 19:04:05 +0000 (19:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30573 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 3e53ae0ed3fd0d0cf510e277ae1ceac60e786124..c30a222b4acc3ff154ede07d74d084339c0303c4 100644 (file)
@@ -407,8 +407,13 @@ void DAGCombiner::Run(bool RunningAfterLegalize) {
               std::cerr << "\nWith: "; RV.Val->dump(&DAG);
               std::cerr << '\n');
         std::vector<SDNode*> NowDead;
-        SDOperand OpV = RV;
-        DAG.ReplaceAllUsesWith(N, &OpV, &NowDead);
+        if (N->getNumValues() == RV.Val->getNumValues())
+          DAG.ReplaceAllUsesWith(N, RV.Val, &NowDead);
+        else {
+          assert(N->getValueType(0) == RV.getValueType() && "Type mismatch");
+          SDOperand OpV = RV;
+          DAG.ReplaceAllUsesWith(N, &OpV, &NowDead);
+        }
           
         // Push the new node and any users onto the worklist
         WorkList.push_back(RV.Val);