Fix PR1782, patch by Wojtek Matyjewicz!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44733 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2007-12-09 07:35:13 +00:00
parent 8d1ea75060
commit f88380ba2c
2 changed files with 35 additions and 4 deletions

View File

@ -730,8 +730,8 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
if (Op1C->getZExtValue() >= AT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses
} else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty)) {
if (Op1C->getZExtValue() >= PT->getNumElements())
} else if (const VectorType *VT = dyn_cast<VectorType>(BasePtr1Ty)) {
if (Op1C->getZExtValue() >= VT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses
}
@ -756,10 +756,10 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (Op2) {
if (const ConstantInt *Op2C = dyn_cast<ConstantInt>(Op2)) {
// If this is an array index, make sure the array element is in range.
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr2Ty)) {
if (Op2C->getZExtValue() >= AT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses
} else if (const VectorType *VT = dyn_cast<VectorType>(BasePtr1Ty)) {
} else if (const VectorType *VT = dyn_cast<VectorType>(BasePtr2Ty)) {
if (Op2C->getZExtValue() >= VT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses
}