From d224252b5d4ad3528907923fd6304aa33df47314 Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 31 Oct 2011 08:28:51 -0700 Subject: [PATCH] Fix bug where multiplying varying array offset by zero would cause crash in optimization passes. --- opt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opt.cpp b/opt.cpp index 9efe63a4..cf342172 100644 --- a/opt.cpp +++ b/opt.cpp @@ -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 *));