[llvm-commits] [llvm] r46305 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Chris Lattner sabre at nondot.org
Wed Jan 23 23:18:22 PST 2008


Author: lattner
Date: Thu Jan 24 01:18:21 2008
New Revision: 46305

URL: http://llvm.org/viewvc/llvm-project?rev=46305&view=rev
Log:
The dag combiner is missing revisiting nodes that it really should, and thus leaving
dead stuff around.  This gets fed into the isel pass and causes certain foldings from
happening because nodes have extraneous uses floating around.  For example, if we turned
foo(bar(x)) -> baz(x), we sometimes left bar(x) around.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=46305&r1=46304&r2=46305&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Jan 24 01:18:21 2008
@@ -606,6 +606,11 @@
         // Push the new node and any users onto the worklist
         AddToWorkList(RV.Val);
         AddUsersToWorkList(RV.Val);
+        
+        // Add any uses of the old node to the worklist if they have a single
+        // use.  They may be dead after this node is deleted.
+        for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
+          AddToWorkList(N->getOperand(i).Val);
           
         // Nodes can be reintroduced into the worklist.  Make sure we do not
         // process a node that has been replaced.





More information about the llvm-commits mailing list