From b58f32f7a84e98b51fd87ac9b49dba02b06fa7bc Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 5 Jun 2015 10:52:40 +0000 Subject: [LoopVectorize] Don't crash on zero-sized types in isInductionPHI isInductionPHI wants to calculate the stride based on the pointee size. However, this is not possible when the pointee is zero sized. This fixes PR23763. llvm-svn: 239143 --- llvm/lib/Transforms/Utils/LoopUtils.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index a5890c0..5f25e6b 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -491,6 +491,9 @@ bool llvm::isInductionPHI(PHINode *Phi, ScalarEvolution *SE, const DataLayout &DL = Phi->getModule()->getDataLayout(); int64_t Size = static_cast(DL.getTypeAllocSize(PointerElementType)); + if (!Size) + return false; + int64_t CVSize = CV->getSExtValue(); if (CVSize % Size) return false; -- cgit v1.1