[llvm] r360031 - [LoadStoreVectorizer] vectorizeStoreChain - ensure we find a store type.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon May 6 03:25:12 PDT 2019
Author: rksimon
Date: Mon May 6 03:25:11 2019
New Revision: 360031
URL: http://llvm.org/viewvc/llvm-project?rev=360031&view=rev
Log:
[LoadStoreVectorizer] vectorizeStoreChain - ensure we find a store type.
Properly initialize store type to null then ensure we find a real store type in the chain.
Fixes scan-build null dereference warning and makes the code clearer.
Modified:
llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
Modified: llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp?rev=360031&r1=360030&r2=360031&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp Mon May 6 03:25:11 2019
@@ -926,7 +926,7 @@ bool Vectorizer::vectorizeStoreChain(
StoreInst *S0 = cast<StoreInst>(Chain[0]);
// If the vector has an int element, default to int for the whole store.
- Type *StoreTy;
+ Type *StoreTy = nullptr;
for (Instruction *I : Chain) {
StoreTy = cast<StoreInst>(I)->getValueOperand()->getType();
if (StoreTy->isIntOrIntVectorTy())
@@ -938,6 +938,7 @@ bool Vectorizer::vectorizeStoreChain(
break;
}
}
+ assert(StoreTy && "Failed to find store type");
unsigned Sz = DL.getTypeSizeInBits(StoreTy);
unsigned AS = S0->getPointerAddressSpace();
More information about the llvm-commits
mailing list