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

Chris Lattner lattner at cs.uiuc.edu
Mon Dec 19 14:21:33 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.225 -> 1.226
---
Log message:

Fix a case where the DAG Combiner would accidentally CSE flag-producing nodes,
creating graphs that cannot be scheduled.


---
Diffs of the changes:  (+6 -1)

 SelectionDAG.cpp |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.225 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.226
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.225	Fri Dec 16 16:45:28 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Mon Dec 19 16:21:21 2005
@@ -389,9 +389,14 @@
   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(),






More information about the llvm-commits mailing list