[llvm] r186558 - Give 'hasPath' a longer but clearer name 'isPotentiallyReachable'. Also expand
Nick Lewycky
nicholas at mxc.ca
Wed Jul 17 19:34:52 PDT 2013
Author: nicholas
Date: Wed Jul 17 21:34:51 2013
New Revision: 186558
URL: http://llvm.org/viewvc/llvm-project?rev=186558&view=rev
Log:
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 .
Modified:
llvm/trunk/lib/Analysis/AliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=186558&r1=186557&r2=186558&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Wed Jul 17 21:34:51 2013
@@ -361,9 +361,11 @@ AliasAnalysis::getModRefInfo(const Atomi
}
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;
More information about the llvm-commits
mailing list