[llvm-commits] [llvm] r72231 - in /llvm/trunk: include/llvm/Analysis/Dominators.h test/DebugInfo/2009-01-15-RecordVariableCrash.ll test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll

Eli Friedman eli.friedman at gmail.com
Thu May 21 14:47:54 PDT 2009


Author: efriedma
Date: Thu May 21 16:47:54 2009
New Revision: 72231

URL: http://llvm.org/viewvc/llvm-project?rev=72231&view=rev
Log:
Fix broken logic in DominatorTreeBase::Split.  Part of PR4238.


Modified:
    llvm/trunk/include/llvm/Analysis/Dominators.h
    llvm/trunk/test/DebugInfo/2009-01-15-RecordVariableCrash.ll
    llvm/trunk/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll

Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=72231&r1=72230&r2=72231&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Thu May 21 16:47:54 2009
@@ -251,49 +251,16 @@
 
     assert(!PredBlocks.empty() && "No predblocks??");
 
-    // The newly inserted basic block will dominate existing basic blocks iff the
-    // PredBlocks dominate all of the non-pred blocks.  If all predblocks dominate
-    // the non-pred blocks, then they all must be the same block!
-    //
     bool NewBBDominatesNewBBSucc = true;
-    {
-      typename GraphT::NodeType* OnePred = PredBlocks[0];
-      size_t i = 1, e = PredBlocks.size();
-      for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) {
-        assert(i != e && "Didn't find reachable pred?");
-        OnePred = PredBlocks[i];
+    for (typename GraphTraits<Inverse<N> >::ChildIteratorType PI =
+         GraphTraits<Inverse<N> >::child_begin(NewBBSucc),
+         E = GraphTraits<Inverse<N> >::child_end(NewBBSucc); PI != E; ++PI)
+      if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI) &&
+          DT.isReachableFromEntry(*PI)) {
+        NewBBDominatesNewBBSucc = false;
+        break;
       }
 
-      for (; i != e; ++i)
-        if (PredBlocks[i] != OnePred && DT.isReachableFromEntry(OnePred)) {
-          NewBBDominatesNewBBSucc = false;
-          break;
-        }
-
-      if (NewBBDominatesNewBBSucc)
-        for (typename GraphTraits<Inverse<N> >::ChildIteratorType PI =
-             GraphTraits<Inverse<N> >::child_begin(NewBBSucc),
-             E = GraphTraits<Inverse<N> >::child_end(NewBBSucc); PI != E; ++PI)
-          if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) {
-            NewBBDominatesNewBBSucc = false;
-            break;
-          }
-    }
-
-    // The other scenario where the new block can dominate its successors are when
-    // all predecessors of NewBBSucc that are not NewBB are dominated by NewBBSucc
-    // already.
-    if (!NewBBDominatesNewBBSucc) {
-      NewBBDominatesNewBBSucc = true;
-      for (typename GraphTraits<Inverse<N> >::ChildIteratorType PI = 
-           GraphTraits<Inverse<N> >::child_begin(NewBBSucc),
-           E = GraphTraits<Inverse<N> >::child_end(NewBBSucc); PI != E; ++PI)
-        if (*PI != NewBB && !DT.dominates(NewBBSucc, *PI)) {
-          NewBBDominatesNewBBSucc = false;
-          break;
-        }
-    }
-
     // Find NewBB's immediate dominator and create new dominator tree node for
     // NewBB.
     NodeT *NewBBIDom = 0;

Modified: llvm/trunk/test/DebugInfo/2009-01-15-RecordVariableCrash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2009-01-15-RecordVariableCrash.ll?rev=72231&r1=72230&r2=72231&view=diff

==============================================================================
--- llvm/trunk/test/DebugInfo/2009-01-15-RecordVariableCrash.ll (original)
+++ llvm/trunk/test/DebugInfo/2009-01-15-RecordVariableCrash.ll Thu May 21 16:47:54 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -f -o /dev/null
+; RUN: llvm-as < %s | llc -f -o /dev/null -verify-dom-info
 	%llvm.dbg.anchor.type = type { i32, i32 }
 	%llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32, i8*, i8* }
 	%llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* }

Modified: llvm/trunk/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll?rev=72231&r1=72230&r2=72231&view=diff

==============================================================================
--- llvm/trunk/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll (original)
+++ llvm/trunk/test/Transforms/LCSSA/2006-10-31-UnreachableBlock-2.ll Thu May 21 16:47:54 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -lcssa -disable-output
+; RUN: llvm-as < %s | opt -lcssa -disable-output -verify-dom-info
 ; PR977
 ; END.
 declare i32 @opost_block()





More information about the llvm-commits mailing list