From: Simon Pilgrim Date: Sun, 15 Sep 2019 16:44:35 +0000 (+0000) Subject: [LoadStoreVectorizer] vectorizeLoadChain - ensure we find a valid Type down the load... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81bcd7a8580b03cbbc9e06bd126d64eb3c0002a7;p=llvm [LoadStoreVectorizer] vectorizeLoadChain - ensure we find a valid Type down the load chain. NFCI. Silence static analyzer uninitialized variable warning by setting the LoadTy to null and then asserting we find a real value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371936 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index 5f97740a9c6..f44976c723e 100644 --- a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -1092,7 +1092,7 @@ bool Vectorizer::vectorizeLoadChain( LoadInst *L0 = cast(Chain[0]); // If the vector has an int element, default to int for the whole load. - Type *LoadTy; + Type *LoadTy = nullptr; for (const auto &V : Chain) { LoadTy = cast(V)->getType(); if (LoadTy->isIntOrIntVectorTy()) @@ -1104,6 +1104,7 @@ bool Vectorizer::vectorizeLoadChain( break; } } + assert(LoadTy && "Can't determine LoadInst type from chain"); unsigned Sz = DL.getTypeSizeInBits(LoadTy); unsigned AS = L0->getPointerAddressSpace();