diff options
| author | ErikHogeman <erik.hogeman@arm.com> | 2024-09-06 11:20:14 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-06 11:20:14 +0200 |
| commit | 78e1e6ace6c99ac3c96216a40836a1ac98d4f000 (patch) | |
| tree | 1bd35e582309571e33d9fb474a5a133decde9d32 /llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | |
| parent | 66a03295de26c61a2178bb3a697d355592cb0eb5 (diff) | |
[LV] Check for vector-to-scalar casts in legalizer (#106244)
The code makes assumptions later on the operations and their inputs
being scalar in the loops that are processed, so we should make sure
this is the case in the legalizer.
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp index 7042af6dd8ea..7062e21383a5 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp @@ -943,9 +943,12 @@ bool LoopVectorizationLegality::canVectorizeInstrs() { VecCallVariantsFound = true; // Check that the instruction return type is vectorizable. + // We can't vectorize casts from vector type to scalar type. // Also, we can't vectorize extractelement instructions. if ((!VectorType::isValidElementType(I.getType()) && !I.getType()->isVoidTy()) || + (isa<CastInst>(I) && + !VectorType::isValidElementType(I.getOperand(0)->getType())) || isa<ExtractElementInst>(I)) { reportVectorizationFailure("Found unvectorizable type", "instruction return type cannot be vectorized", |
