diff options
author | Chris Lattner <sabre@nondot.org> | 2002-09-17 21:05:42 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-09-17 21:05:42 +0000 |
commit | dfcbf012226c17faba2bfc2f967ac2496fb98238 (patch) | |
tree | 8644f37e71d4abe01d1db09c4492d83d25ffa601 | |
parent | 44404ec89dfe4221eaa043070b45bc4601e417ba (diff) | |
download | external_llvm-dfcbf012226c17faba2bfc2f967ac2496fb98238.zip external_llvm-dfcbf012226c17faba2bfc2f967ac2496fb98238.tar.gz external_llvm-dfcbf012226c17faba2bfc2f967ac2496fb98238.tar.bz2 |
Fix bug: test/Regression/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll
Thanks to Casey for finding it!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3783 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 179f3b2..082dc02 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -669,7 +669,8 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { *cast<Constant>(GEP.getOperand(1)); assert(Indices[0] != 0 && "Constant folding of uint's failed!?"); - } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy)) { + } else if (*GEP.idx_begin() == ConstantUInt::getNullValue(Type::LongTy) && + Src->getNumOperands() != 1) { // Otherwise we can do the fold if the first index of the GEP is a zero Indices.insert(Indices.end(), Src->idx_begin(), Src->idx_end()); Indices.insert(Indices.end(), GEP.idx_begin()+1, GEP.idx_end()); |