From 6ab19ed78d5a61869a9ebaf3b74ce5a07382a89f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 1 Nov 2007 02:30:35 +0000 Subject: Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious (in hindsight) infinite recursion. Simplify the code. llvm-svn: 43597 --- llvm/lib/VMCore/Constants.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'llvm/lib/VMCore') diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 262595fc8f3..74f62874501 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -2268,18 +2268,14 @@ std::string Constant::getStringValue(bool Chop, unsigned Offset) { } } } - } else if (Constant *C = dyn_cast(this)) { - if (GlobalValue *GV = dyn_cast(C)) - return GV->getStringValue(Chop, Offset); - else if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { - // Turn a gep into the specified offset. - if (CE->getNumOperands() == 3 && - cast(CE->getOperand(1))->isNullValue() && - isa(CE->getOperand(2))) { - Offset += cast(CE->getOperand(2))->getZExtValue(); - return CE->getOperand(0)->getStringValue(Chop, Offset); - } + } else if (ConstantExpr *CE = dyn_cast(this)) { + if (CE->getOpcode() == Instruction::GetElementPtr) { + // Turn a gep into the specified offset. + if (CE->getNumOperands() == 3 && + cast(CE->getOperand(1))->isNullValue() && + isa(CE->getOperand(2))) { + Offset += cast(CE->getOperand(2))->getZExtValue(); + return CE->getOperand(0)->getStringValue(Chop, Offset); } } } -- cgit v1.2.3