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 | 6ab19ed78d5a61869a9ebaf3b74ce5a07382a89f (patch) | |
| tree | 81b45214bd75ffe0a6db664aac1d9d0054d26a0a /llvm/lib/VMCore | |
| parent | 74709473ed3a0b351d490f05f2fcd339bbf6da1e (diff) | |
| download | bcm5719-llvm-6ab19ed78d5a61869a9ebaf3b74ce5a07382a89f.tar.gz bcm5719-llvm-6ab19ed78d5a61869a9ebaf3b74ce5a07382a89f.zip | |
Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion.  Simplify the code.
llvm-svn: 43597
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 20 | 
1 files changed, 8 insertions, 12 deletions
| 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<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);        }      }    } | 

