From: Simon Pilgrim Date: Wed, 22 May 2019 13:02:19 +0000 (+0000) Subject: [CGOpenMPRuntime] emitX86DeclareSimdFunction - assert simdlen/cdtsize is not zero... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc1665e0c4c1261540d881b75c8b97d9121c6eed;p=clang [CGOpenMPRuntime] emitX86DeclareSimdFunction - assert simdlen/cdtsize is not zero. NFCI. Fixes scan-build division by zero warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361379 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGOpenMPRuntime.cpp b/lib/CodeGen/CGOpenMPRuntime.cpp index 0897b4765e..651cca4993 100644 --- a/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/lib/CodeGen/CGOpenMPRuntime.cpp @@ -9774,8 +9774,9 @@ emitX86DeclareSimdFunction(const FunctionDecl *FD, llvm::Function *Fn, llvm::raw_svector_ostream Out(Buffer); Out << "_ZGV" << Data.ISA << Mask; if (!VLENVal) { - Out << llvm::APSInt::getUnsigned(Data.VecRegSize / - evaluateCDTSize(FD, ParamAttrs)); + unsigned NumElts = evaluateCDTSize(FD, ParamAttrs); + assert(NumElts && "Non-zero simdlen/cdtsize expected"); + Out << llvm::APSInt::getUnsigned(Data.VecRegSize / NumElts); } else { Out << VLENVal; }