diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index a4f20c86e1ec0a..dab5d3fe68a80f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3269,6 +3269,8 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch, assert(RecNo < RecordedNodes.size() && "Invalid EmitMergeInputChains"); ChainNodesMatched.push_back(RecordedNodes[RecNo].first.getNode()); + // If the chained node is not the root, we can't fold it if it has + // multiple uses. // FIXME: What if other value results of the node have uses not matched // by this pattern? if (ChainNodesMatched.back() != NodeToMatch && @@ -3306,6 +3308,8 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch, assert(RecNo < RecordedNodes.size() && "Invalid EmitMergeInputChains"); ChainNodesMatched.push_back(RecordedNodes[RecNo].first.getNode()); + // If the chained node is not the root, we can't fold it if it has + // multiple uses. // FIXME: What if other value results of the node have uses not matched // by this pattern? if (ChainNodesMatched.back() != NodeToMatch &&