[LoopVectorize] Don't crash on zero-sized types in isInductionPHI
[oota-llvm.git] / lib / Transforms / Utils / LoopUtils.cpp
index a5890c0adb067071f42631dd36b5a4e135c546e0..5f25e6b2cb6f94090ecbd8987bf1ee0659c0c95a 100644 (file)
@@ -491,6 +491,9 @@ bool llvm::isInductionPHI(PHINode *Phi, ScalarEvolution *SE,
 
   const DataLayout &DL = Phi->getModule()->getDataLayout();
   int64_t Size = static_cast<int64_t>(DL.getTypeAllocSize(PointerElementType));
+  if (!Size)
+    return false;
+
   int64_t CVSize = CV->getSExtValue();
   if (CVSize % Size)
     return false;