[llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Oct 4 09:51:01 PDT 2002


Changes in directory llvm/lib/Analysis:

PostDominators.cpp updated: 1.37 -> 1.38

---
Log message:

Handle post dominance correctly in the case where blocks do not have a path to 
the exit node.


---
Diffs of the changes:

Index: llvm/lib/Analysis/PostDominators.cpp
diff -u llvm/lib/Analysis/PostDominators.cpp:1.37 llvm/lib/Analysis/PostDominators.cpp:1.38
--- llvm/lib/Analysis/PostDominators.cpp:1.37	Wed Aug 21 18:43:34 2002
+++ llvm/lib/Analysis/PostDominators.cpp	Fri Oct  4 09:50:20 2002
@@ -59,6 +59,18 @@
 	  if (PredSet.size())
 	    set_intersect(WorkingSet, PredSet);
 	}
+      } else if (BB != Root) {
+        // If this isn't the root basic block and it has no successors, it must
+        // be an non-returning block.  Fib a bit by saying that the root node
+        // postdominates this unreachable node.  This isn't exactly true,
+        // because there is no path from this node to the root node, but it is
+        // sorta true because any paths to the exit node would have to go
+        // through this node.
+        //
+        // This allows for postdominator properties to be built for code that
+        // doesn't return in a reasonable manner.
+        //
+        WorkingSet = Doms[Root];
       }
 	
       WorkingSet.insert(BB);           // A block always dominates itself





More information about the llvm-commits mailing list