Fix PR3667

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65464 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2009-02-25 18:20:01 +00:00
parent 411c285404
commit 58b1ac76d4
2 changed files with 39 additions and 1 deletions

View File

@@ -10837,7 +10837,7 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
// out, perform the transformation. Note, we don't know whether Scale is
// signed or not. We'll use unsigned version of division/modulo
// operation after making sure Scale doesn't have the sign bit set.
if (Scale && Scale->getSExtValue() >= 0LL &&
if (ArrayEltSize && Scale && Scale->getSExtValue() >= 0LL &&
Scale->getZExtValue() % ArrayEltSize == 0) {
Scale = ConstantInt::get(Scale->getType(),
Scale->getZExtValue() / ArrayEltSize);