mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 15:33:33 +00:00
Limit the number of times we're willing to chase pointers. Removes an O(n^2)
problem from instcombine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69151 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
37a4d8dbbb
commit
300e36503c
@ -365,6 +365,7 @@ Value *Value::getUnderlyingObject() {
|
|||||||
if (!isa<PointerType>(getType()))
|
if (!isa<PointerType>(getType()))
|
||||||
return this;
|
return this;
|
||||||
Value *V = this;
|
Value *V = this;
|
||||||
|
unsigned MaxLookup = 6;
|
||||||
do {
|
do {
|
||||||
if (Instruction *I = dyn_cast<Instruction>(V)) {
|
if (Instruction *I = dyn_cast<Instruction>(V)) {
|
||||||
if (!isa<BitCastInst>(I) && !isa<GetElementPtrInst>(I))
|
if (!isa<BitCastInst>(I) && !isa<GetElementPtrInst>(I))
|
||||||
@ -379,7 +380,8 @@ Value *Value::getUnderlyingObject() {
|
|||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
assert(isa<PointerType>(V->getType()) && "Unexpected operand type!");
|
assert(isa<PointerType>(V->getType()) && "Unexpected operand type!");
|
||||||
} while (1);
|
} while (--MaxLookup);
|
||||||
|
return V;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// DoPHITranslation - If this value is a PHI node with CurBB as its parent,
|
/// DoPHITranslation - If this value is a PHI node with CurBB as its parent,
|
||||||
|
Loading…
Reference in New Issue
Block a user