[mlir][vector] Support for extracting 1-element vectors in VectorExtractOpConversion (#107549)
This patch adds support for converting `vector.extract` that extract 1-element vectors into LLVM, fixing a crash in such cases. E.g., `vector.extract %1[0]: vector<1xf32> from vector<2xf32>`. Fix #61372.
This commit is contained in:
@@ -1104,7 +1104,10 @@ public:
|
||||
}
|
||||
|
||||
// One-shot extraction of vector from array (only requires extractvalue).
|
||||
if (isa<VectorType>(resultType)) {
|
||||
// Except for extracting 1-element vectors.
|
||||
if (isa<VectorType>(resultType) &&
|
||||
position.size() !=
|
||||
static_cast<size_t>(extractOp.getSourceVectorType().getRank())) {
|
||||
if (extractOp.hasDynamicPosition())
|
||||
return failure();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user