mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-02 22:23:10 +00:00
Re-introduce the MaxLookup limit to BasicAliasAnalysis'
pointsToConstantMemory code to guard against possible compile time slowdowns. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118440 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -524,6 +524,7 @@ bool
|
|||||||
BasicAliasAnalysis::pointsToConstantMemory(const Location &Loc, bool OrLocal) {
|
BasicAliasAnalysis::pointsToConstantMemory(const Location &Loc, bool OrLocal) {
|
||||||
assert(Visited.empty() && "Visited must be cleared after use!");
|
assert(Visited.empty() && "Visited must be cleared after use!");
|
||||||
|
|
||||||
|
unsigned MaxLookup = 8;
|
||||||
SmallVector<const Value *, 16> Worklist;
|
SmallVector<const Value *, 16> Worklist;
|
||||||
Worklist.push_back(Loc.Ptr);
|
Worklist.push_back(Loc.Ptr);
|
||||||
do {
|
do {
|
||||||
@@ -559,6 +560,11 @@ BasicAliasAnalysis::pointsToConstantMemory(const Location &Loc, bool OrLocal) {
|
|||||||
// If all values incoming to a phi node point to local memory, then so does
|
// If all values incoming to a phi node point to local memory, then so does
|
||||||
// the phi.
|
// the phi.
|
||||||
if (const PHINode *PN = dyn_cast<PHINode>(V)) {
|
if (const PHINode *PN = dyn_cast<PHINode>(V)) {
|
||||||
|
// Don't bother inspecting phi nodes with many operands.
|
||||||
|
if (PN->getNumIncomingValues() > MaxLookup) {
|
||||||
|
Visited.clear();
|
||||||
|
return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
|
||||||
|
}
|
||||||
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
|
||||||
Worklist.push_back(PN->getIncomingValue(i));
|
Worklist.push_back(PN->getIncomingValue(i));
|
||||||
continue;
|
continue;
|
||||||
@@ -568,10 +574,10 @@ BasicAliasAnalysis::pointsToConstantMemory(const Location &Loc, bool OrLocal) {
|
|||||||
Visited.clear();
|
Visited.clear();
|
||||||
return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
|
return AliasAnalysis::pointsToConstantMemory(Loc, OrLocal);
|
||||||
|
|
||||||
} while (!Worklist.empty());
|
} while (!Worklist.empty() && --MaxLookup);
|
||||||
|
|
||||||
Visited.clear();
|
Visited.clear();
|
||||||
return true;
|
return Worklist.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getModRefBehavior - Return the behavior when calling the given call site.
|
/// getModRefBehavior - Return the behavior when calling the given call site.
|
||||||
|
|||||||
Reference in New Issue
Block a user