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 | 2734ebd37f0a9468789533cf395a3d088f8a151d (patch) | |
tree | 0c8334f318b4d135091d132267c0da1f87e6ff81 /llvm/lib/Analysis | |
parent | 474e488c06fb59b53f597515c01aee140707451f (diff) | |
download | bcm5719-llvm-2734ebd37f0a9468789533cf395a3d088f8a151d.tar.gz bcm5719-llvm-2734ebd37f0a9468789533cf395a3d088f8a151d.zip |
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.
llvm-svn: 98179
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 2139c29cc1f..1001d2b5460 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/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; } } |