summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/VMCore/Value.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/Value.cpp b/llvm/lib/VMCore/Value.cpp
index 499b936e29c..af3f4e70784 100644
--- a/llvm/lib/VMCore/Value.cpp
+++ b/llvm/lib/VMCore/Value.cpp
@@ -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,
OpenPOWER on IntegriCloud