[llvm-commits] [llvm] r107883 - /llvm/trunk/include/llvm/Analysis/DominatorInternals.h
Gabor Greif
ggreif at gmail.com
Thu Jul 8 09:56:18 PDT 2010
Author: ggreif
Date: Thu Jul 8 11:56:18 2010
New Revision: 107883
URL: http://llvm.org/viewvc/llvm-project?rev=107883&view=rev
Log:
only dereference iterator once in the loop
(by caching the result we save a potentially expensive dereference)
also use typedefs to shorten type declarations
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=107883&r1=107882&r2=107883&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DominatorInternals.h (original)
+++ llvm/trunk/include/llvm/Analysis/DominatorInternals.h Thu Jul 8 11:56:18 2010
@@ -265,14 +265,17 @@
// initialize the semi dominator to point to the parent node
WInfo.Semi = WInfo.Parent;
- for (typename GraphTraits<Inverse<NodeT> >::ChildIteratorType CI =
- GraphTraits<Inverse<NodeT> >::child_begin(W),
- E = GraphTraits<Inverse<NodeT> >::child_end(W); CI != E; ++CI)
- if (DT.Info.count(*CI)) { // Only if this predecessor is reachable!
- unsigned SemiU = DT.Info[Eval<GraphT>(DT, *CI)].Semi;
+ typedef GraphTraits<Inverse<NodeT> > InvTraits;
+ for (typename InvTraits::ChildIteratorType CI =
+ InvTraits::child_begin(W),
+ E = InvTraits::child_end(W); CI != E; ++CI) {
+ typename InvTraits::NodeType *N = *CI;
+ if (DT.Info.count(N)) { // Only if this predecessor is reachable!
+ unsigned SemiU = DT.Info[Eval<GraphT>(DT, N)].Semi;
if (SemiU < WInfo.Semi)
WInfo.Semi = SemiU;
}
+ }
DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W);
More information about the llvm-commits
mailing list