diff options
author | Dan Gohman <gohman@apple.com> | 2010-03-10 19:38:49 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-03-10 19:38:49 +0000 |
commit | bbf81d88116d23fb0776412b5916f7d0b8b3ca7e (patch) | |
tree | 5f7c42f02f48b98837c3eeba3191dbb2cd588975 /lib/Analysis/LoopInfo.cpp | |
parent | 0891d752a68a25025ffc3339aab1f0ad3221b0ed (diff) |
Add a DominatorTree argument to isLCSSA so that it doesn't have to
compute a set of reachable blocks for itself each time it is called, which
is fairly frequently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98179 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r-- | lib/Analysis/LoopInfo.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index 2139c29cc1..1001d2b546 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -263,14 +263,7 @@ unsigned Loop::getSmallConstantTripMultiple() const { } /// isLCSSAForm - Return true if the Loop is in LCSSA form -bool Loop::isLCSSAForm() const { - // Collect all the reachable blocks in the function, for fast lookups. - SmallPtrSet<BasicBlock *, 32> ReachableBBs; - BasicBlock *EntryBB = getHeader()->getParent()->begin(); - for (df_iterator<BasicBlock *> NI = df_begin(EntryBB), - NE = df_end(EntryBB); NI != NE; ++NI) - ReachableBBs.insert(*NI); - +bool Loop::isLCSSAForm(DominatorTree &DT) const { // Sort the blocks vector so that we can use binary search to do quick // lookups. SmallPtrSet<BasicBlock *, 16> LoopBBs(block_begin(), block_end()); @@ -290,7 +283,7 @@ bool Loop::isLCSSAForm() const { // entry are special; uses in them don't need to go through PHIs. if (UserBB != BB && !LoopBBs.count(UserBB) && - ReachableBBs.count(UserBB)) + DT.isReachableFromEntry(UserBB)) return false; } } |