summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-07-18 02:34:51 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-07-18 02:34:51 +0000
commit0dcefdfcab8975632c638a12bf252a38e9acd33b (patch)
tree04f7e8b21cbd29a63b1edf2def44509cf1346d16 /llvm/lib/Analysis/AliasAnalysis.cpp
parentb75016d29901ece3509f433c0adb6e9263562597 (diff)
downloadbcm5719-llvm-0dcefdfcab8975632c638a12bf252a38e9acd33b.tar.gz
bcm5719-llvm-0dcefdfcab8975632c638a12bf252a38e9acd33b.zip
Give 'hasPath' a longer but clearer name 'isPotentiallyReachable'. Also expand
the comment. No functionality change. This change broken out of http://llvm-reviews.chandlerc.com/D996 . llvm-svn: 186558
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 054930c0e19..5be5613b124 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -361,9 +361,11 @@ AliasAnalysis::getModRefInfo(const AtomicRMWInst *RMW, const Location &Loc) {
}
namespace {
- // Conservatively return true. Return false, if there is a single path
- // starting from "From" and the path does not reach "To".
- static bool hasPath(const BasicBlock *From, const BasicBlock *To) {
+ /// Determine whether there is a path from From to To within a single
+ /// function. Returns false only if we can prove that once 'From' has been
+ /// executed then 'To' can not be executed. Conservatively returns true.
+ static bool isPotentiallyReachable(const BasicBlock *From,
+ const BasicBlock *To) {
const unsigned MaxCheck = 5;
const BasicBlock *Current = From;
for (unsigned I = 0; I < MaxCheck; I++) {
@@ -400,7 +402,7 @@ namespace {
// there is no need to explore the use if BeforeHere dominates use.
// Check whether there is a path from I to BeforeHere.
if (BeforeHere != I && DT->dominates(BeforeHere, I) &&
- !hasPath(BB, BeforeHere->getParent()))
+ !isPotentiallyReachable(BB, BeforeHere->getParent()))
return false;
return true;
}
@@ -412,7 +414,7 @@ namespace {
if (BeforeHere != I && !DT->isReachableFromEntry(BB))
return false;
if (BeforeHere != I && DT->dominates(BeforeHere, I) &&
- !hasPath(BB, BeforeHere->getParent()))
+ !isPotentiallyReachable(BB, BeforeHere->getParent()))
return false;
Captured = true;
return true;
OpenPOWER on IntegriCloud