diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-09-15 16:44:35 +0000 | 
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-09-15 16:44:35 +0000 | 
| commit | 4e46ea3946cb12a165574a973f5b928fc692c850 (patch) | |
| tree | 99a2465f2bde29275f980e85bd2f3e15d1d8bf35 /llvm/lib/Transforms/Vectorize | |
| parent | 2b4ace3f2990a8e035c1bfd3f6b0dabc143db0c6 (diff) | |
| download | bcm5719-llvm-4e46ea3946cb12a165574a973f5b928fc692c850.tar.gz bcm5719-llvm-4e46ea3946cb12a165574a973f5b928fc692c850.zip  | |
[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.
llvm-svn: 371936
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index 5f97740a9c6..f44976c723e 100644 --- a/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -1092,7 +1092,7 @@ bool Vectorizer::vectorizeLoadChain(    LoadInst *L0 = cast<LoadInst>(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<LoadInst>(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();  | 

