Fix bug where multiplying varying array offset by zero would cause crash in optimization passes.

This commit is contained in:
Matt Pharr
2011-10-31 08:28:51 -07:00
parent e009c0a61d
commit d224252b5d

View File

@@ -2288,7 +2288,7 @@ lVectorIsLinear(llvm::Value **v, int vectorLength, int stride,
// set of integer values will give a sequence with the desired
// stride.
int mulScale = (int)scaleValue->getZExtValue();
if ((stride % mulScale) != 0)
if (mulScale == 0 || (stride % mulScale) != 0)
return false;
llvm::Value **otherValue = (llvm::Value **)alloca(vectorLength * sizeof(llvm::Value *));