diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-11-28 15:12:41 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-11-28 15:12:41 +0000 |
| commit | c7bc66dfc6f763b990ccab357fc5334e4274f708 (patch) | |
| tree | f9671acddf2662c54447ae450646d21671c0b11b /llvm/lib/Analysis | |
| parent | d5bd369a0f8130927f4a690f8941e5974f1481de (diff) | |
| download | bcm5719-llvm-c7bc66dfc6f763b990ccab357fc5334e4274f708.tar.gz bcm5719-llvm-c7bc66dfc6f763b990ccab357fc5334e4274f708.zip | |
implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it.
This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!'
assertion on sqlite3.
llvm-svn: 90038
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 3e6af58aa93..31d3ccca36a 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -1028,9 +1028,11 @@ static Value *GetLinearExpression(Value *V, APInt &Scale, APInt &Offset, const Value *llvm::DecomposeGEPExpression(const Value *V, int64_t &BaseOffs, SmallVectorImpl<std::pair<const Value*, int64_t> > &VarIndices, const TargetData *TD) { - // FIXME: Should limit depth like getUnderlyingObject? + // Limit recursion depth to limit compile time in crazy cases. + unsigned MaxLookup = 6; + BaseOffs = 0; - while (1) { + do { // See if this is a bitcast or GEP. const Operator *Op = dyn_cast<Operator>(V); if (Op == 0) { @@ -1128,7 +1130,10 @@ const Value *llvm::DecomposeGEPExpression(const Value *V, int64_t &BaseOffs, // Analyze the base pointer next. V = GEPOp->getOperand(0); - } + } while (--MaxLookup); + + // If the chain of expressions is too deep, just return early. + return V; } |

