Don't forget the existing root.
authorChris Lattner <sabre@nondot.org>
Thu, 13 Jan 2005 19:53:14 +0000 (19:53 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 13 Jan 2005 19:53:14 +0000 (19:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19531 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 8f0a916d68dc127a8c6ae2a6a5fd25e1f61162d6..6a81975292c344b272c9d5a7b5572ea4c4ef37a4 100644 (file)
@@ -878,10 +878,8 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
   ConstantsOut.clear();
 
   // Turn all of the unordered chains into one factored node.
-  switch (UnorderedChains.size()) {
-  case 0: break;
-  case 1: DAG.setRoot(UnorderedChains[0]); break;
-  default:
+  if (!UnorderedChains.empty()) {
+    UnorderedChains.push_back(DAG.getRoot());
     DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, UnorderedChains));
   }