mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +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()))
|
||||
return this;
|
||||
Value *V = this;
|
||||
unsigned MaxLookup = 6;
|
||||
do {
|
||||
if (Instruction *I = dyn_cast<Instruction>(V)) {
|
||||
if (!isa<BitCastInst>(I) && !isa<GetElementPtrInst>(I))
|
||||
@ -379,7 +380,8 @@ Value *Value::getUnderlyingObject() {
|
||||
return V;
|
||||
}
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user