Make it simplier to dump DAGs while in DAGCombiner. Remove a nasty optimization.
authorJim Laskey <jlaskey@mac.com>
Tue, 17 Oct 2006 19:33:52 +0000 (19:33 +0000)
committerJim Laskey <jlaskey@mac.com>
Tue, 17 Oct 2006 19:33:52 +0000 (19:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31009 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp

index 474ae281f9102900f180d95ccbbd4a99dd147a0f..997820dd64b4b531d237b0319dbd246d5adcf8e3 100644 (file)
@@ -49,7 +49,7 @@ namespace {
             
   static cl::opt<bool>
     CombinerAA("combiner-alias-analysis", cl::Hidden,
-               cl::desc("Turn on alias analysis turning testing"));
+               cl::desc("Turn on alias analysis during testing"));
 
 //------------------------------ DAGCombiner ---------------------------------//
 
@@ -388,6 +388,9 @@ void DAGCombiner::Run(bool RunningAfterLegalize) {
   // changes of the root.
   HandleSDNode Dummy(DAG.getRoot());
   
+  // The root of the dag may dangle to deleted nodes until the dag combiner is
+  // done.  Set it to null to avoid confusion.
+  DAG.setRoot(SDOperand());
   
   /// DagCombineInfo - Expose the DAG combiner to the target combiner impls.
   TargetLowering::DAGCombinerInfo 
@@ -2759,13 +2762,6 @@ SDOperand DAGCombiner::visitSTORE(SDNode *N) {
   }
   
   if (CombinerAA) { 
-    // If the store ptr is a frame index and the frame index has a use of one
-    // and this is a return block, then the store is redundant.
-    if (Ptr.hasOneUse() && isa<FrameIndexSDNode>(Ptr) &&
-        DAG.getRoot().getOpcode() == ISD::RET) {
-      return Chain;
-    }
-
     // Walk up chain skipping non-aliasing memory nodes.
     SDOperand BetterChain = FindBetterChain(N, Chain);
     
index 5a0f5b1e99f7b6493f5233a69b9e124f8a01617b..9faf703b01f0a341b8da3556afa50c76d31d1aa9 100644 (file)
@@ -2684,7 +2684,7 @@ void SelectionDAG::dump() const {
       DumpNodes(Nodes[i], 2, this);
   }
 
-  DumpNodes(getRoot().Val, 2, this);
+  if (getRoot().Val) DumpNodes(getRoot().Val, 2, this);
 
   std::cerr << "\n\n";
 }
index 486f054ad023db96e3b2490bb4c1c8514e0ec4f2..53e7595f8a55712b4a05e7be6a74dd0068eca6c5 100644 (file)
@@ -61,7 +61,8 @@ namespace llvm {
     static void addCustomGraphFeatures(SelectionDAG *G,
                                        GraphWriter<SelectionDAG*> &GW) {
       GW.emitSimpleNode(0, "plaintext=circle", "GraphRoot");
-      GW.emitEdge(0, -1, G->getRoot().Val, -1, "");
+      if (G->getRoot().Val)
+        GW.emitEdge(0, -1, G->getRoot().Val, -1, "");
     }
   };
 }