mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 07:39:11 +08:00
[SROA] Fix bug where CandidateTys is appended while being iterated
Fix a crash when compiling Skia. See https://reviews.llvm.org/D143225#4180342 for more details
This commit is contained in:
@@ -2030,7 +2030,10 @@ static VectorType *isVectorPromotionViable(Partition &P, const DataLayout &DL) {
|
||||
if (!VectorType::isValidElementType(Ty))
|
||||
continue;
|
||||
unsigned TypeSize = DL.getTypeSizeInBits(Ty).getFixedValue();
|
||||
for (VectorType *&VTy : CandidateTys) {
|
||||
// Make a copy of CandidateTys and iterate through it, because we might
|
||||
// append to CandidateTys in the loop.
|
||||
SmallVector<VectorType *, 4> CandidateTysCopy = CandidateTys;
|
||||
for (VectorType *&VTy : CandidateTysCopy) {
|
||||
unsigned VectorSize = DL.getTypeSizeInBits(VTy).getFixedValue();
|
||||
unsigned ElementSize =
|
||||
DL.getTypeSizeInBits(VTy->getElementType()).getFixedValue();
|
||||
|
||||
Reference in New Issue
Block a user