[llvm-commits] [llvm] r120003 - /llvm/trunk/include/llvm/Analysis/DominatorInternals.h

Cameron Zwarich zwarich at apple.com
Mon Nov 22 22:32:37 PST 2010


Author: zwarich
Date: Tue Nov 23 00:32:37 2010
New Revision: 120003

URL: http://llvm.org/viewvc/llvm-project?rev=120003&view=rev
Log:
Optimize a common case in the Lengauer-Tarjan dominators algorithm. This gives a
9.7% speedup running domtree on test-suite.

Reviewed by Chris Lattner.

Modified:
    llvm/trunk/include/llvm/Analysis/DominatorInternals.h

Modified: llvm/trunk/include/llvm/Analysis/DominatorInternals.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DominatorInternals.h?rev=120003&r1=120002&r2=120003&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Tue Nov 23 00:32:37 2010
@@ -278,9 +278,16 @@
       }
     }
 
-    DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W);
-
     typename GraphT::NodeType* WParent = DT.Vertex[WInfo.Parent];
+
+    // If V is a non-root vertex and sdom(V) = parent(V), then idom(V) is
+    // necessarily parent(V). In this case, set idom(V) here and avoid placing
+    // V into a bucket.
+    if (WInfo.Semi == WInfo.Parent)
+      DT.IDoms[W] = WParent;
+    else
+      DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W);
+
     Link<GraphT>(DT, WInfo.Parent, W, WInfo);
 
     // Step #3: Implicitly define the immediate dominator of vertices





More information about the llvm-commits mailing list