diff options
| author | Suyog Sarda <quic_ssarda@quicinc.com> | 2019-09-21 18:16:37 +0000 |
|---|---|---|
| committer | Suyog Sarda <quic_ssarda@quicinc.com> | 2019-09-21 18:16:37 +0000 |
| commit | cd629ea0a8ef55458e1a75a3ef8e43ad68974479 (patch) | |
| tree | 108fbd02d9a331164d5296d53ffa00fe06672e69 /llvm/lib/Transforms | |
| parent | c62136e6748f1d4f5d94f188203fd998bbb9f588 (diff) | |
| download | bcm5719-llvm-cd629ea0a8ef55458e1a75a3ef8e43ad68974479.tar.gz bcm5719-llvm-cd629ea0a8ef55458e1a75a3ef8e43ad68974479.zip | |
SROA: Check Total Bits of vector type
While Promoting alloca instruction of Vector Type,
Check total size in bits of its slices too.
If they don't match, don't promote the alloca instruction.
Bug : https://bugs.llvm.org/show_bug.cgi?id=42585
llvm-svn: 372480
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 789cdeef173..b55f35831f9 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1888,6 +1888,14 @@ static VectorType *isVectorPromotionViable(Partition &P, const DataLayout &DL) { bool HaveCommonEltTy = true; auto CheckCandidateType = [&](Type *Ty) { if (auto *VTy = dyn_cast<VectorType>(Ty)) { + // Return if bitcast to vectors is different for total size in bits. + if (!CandidateTys.empty()) { + VectorType *V = CandidateTys[0]; + if (DL.getTypeSizeInBits(VTy) != DL.getTypeSizeInBits(V)) { + CandidateTys.clear(); + return; + } + } CandidateTys.push_back(VTy); if (!CommonEltTy) CommonEltTy = VTy->getElementType(); |

