Fix a case where the DAG Combiner would accidentally CSE flag-producing nodes,
authorChris Lattner <sabre@nondot.org>
Mon, 19 Dec 2005 22:21:21 +0000 (22:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 19 Dec 2005 22:21:21 +0000 (22:21 +0000)
creating graphs that cannot be scheduled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24866 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 2fe1b0df0de91d6843561ca68b7eb5b8a39083d6..86ad89e958d19c817d89e88c2b44696cb133feca 100644 (file)
@@ -389,9 +389,14 @@ SDNode *SelectionDAG::AddNonLeafNodeToCSEMaps(SDNode *N) {
   assert(N->getNumOperands() && "This is a leaf node!");
   if (N->getOpcode() == ISD::CALLSEQ_START || 
       N->getOpcode() == ISD::CALLSEQ_END ||
-      N->getOpcode() == ISD::HANDLENODE)
+      N->getOpcode() == ISD::HANDLENODE || N->getValueType(0) == MVT::Flag)
     return 0;    // Never add these nodes.
   
+  // Check that remaining values produced are not flags.
+  for (unsigned i = 1, e = N->getNumValues(); i != e; ++i)
+    if (N->getValueType(i) == MVT::Flag)
+      return 0;   // Never CSE anything that produces a flag.
+  
   if (N->getNumValues() == 1) {
     if (N->getNumOperands() == 1) {
       SDNode *&U = UnaryOps[std::make_pair(N->getOpcode(),