diff options
author | Chris Lattner <sabre@nondot.org> | 2007-11-01 02:30:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-11-01 02:30:35 +0000 |
commit | e41dcdc96441ba2c991c9ea6f5f1451b17c685f7 (patch) | |
tree | 5557d58beab310f7c9b8f2b9f01de2cf594498a0 /lib/VMCore/Constants.cpp | |
parent | 74e012afd33f26e4914bc30f014a2da82f69de82 (diff) | |
download | external_llvm-e41dcdc96441ba2c991c9ea6f5f1451b17c685f7.zip external_llvm-e41dcdc96441ba2c991c9ea6f5f1451b17c685f7.tar.gz external_llvm-e41dcdc96441ba2c991c9ea6f5f1451b17c685f7.tar.bz2 |
Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion. Simplify the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r-- | lib/VMCore/Constants.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 262595f..74f6287 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -2268,18 +2268,14 @@ std::string Constant::getStringValue(bool Chop, unsigned Offset) { } } } - } else if (Constant *C = dyn_cast<Constant>(this)) { - if (GlobalValue *GV = dyn_cast<GlobalValue>(C)) - return GV->getStringValue(Chop, Offset); - else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { - // Turn a gep into the specified offset. - if (CE->getNumOperands() == 3 && - cast<Constant>(CE->getOperand(1))->isNullValue() && - isa<ConstantInt>(CE->getOperand(2))) { - Offset += cast<ConstantInt>(CE->getOperand(2))->getZExtValue(); - return CE->getOperand(0)->getStringValue(Chop, Offset); - } + } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(this)) { + if (CE->getOpcode() == Instruction::GetElementPtr) { + // Turn a gep into the specified offset. + if (CE->getNumOperands() == 3 && + cast<Constant>(CE->getOperand(1))->isNullValue() && + isa<ConstantInt>(CE->getOperand(2))) { + Offset += cast<ConstantInt>(CE->getOperand(2))->getZExtValue(); + return CE->getOperand(0)->getStringValue(Chop, Offset); } } } |