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

Nate Begeman natebegeman at mac.com
Mon Oct 3 17:37:49 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.189 -> 1.190
---
Log message:

Add back a workaround that fixes some breakages from chris's last change.
Neither of us have yet figured out why this code is necessary, but stuff
breaks if its not there.  Still tracking this down...


---
Diffs of the changes:  (+13 -2)

 LegalizeDAG.cpp |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.189 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.190
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.189	Sun Oct  2 12:49:46 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Mon Oct  3 19:37:37 2005
@@ -623,9 +623,20 @@
     Tmp1 = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
     // Do not try to legalize the target-specific arguments (#1+)
     Tmp2 = Node->getOperand(0);
-    if (Tmp1 != Tmp2)
+    if (Tmp1 != Tmp2) {
       Node->setAdjCallChain(Tmp1);
-
+      
+      // If moving the operand from pointing to Tmp2 dropped its use count to 1,
+      // this will cause the maps used to memoize results to get confused.
+      // Create and add a dummy use, just to increase its use count.  This will
+      // be removed at the end of legalize when dead nodes are removed.
+      if (Tmp2.Val->hasOneUse()) {
+        // FIXME: find out why this code is necessary
+        DAG.getNode(ISD::PCMARKER, MVT::Other, Tmp2, 
+                    DAG.getConstant(0, MVT::i32));
+      }
+    }
+      
     // Note that we do not create new CALLSEQ_DOWN/UP nodes here.  These
     // nodes are treated specially and are mutated in place.  This makes the dag
     // legalization process more efficient and also makes libcall insertion






More information about the llvm-commits mailing list