[Mlir-commits] [mlir] [MLIR][Conversion] Vector to LLVM: Remove unneeded vector shuffle (PR #162946)
Sang Ik Lee
llvmlistbot at llvm.org
Tue Oct 14 14:14:07 PDT 2025
================
@@ -1723,12 +1723,17 @@ struct VectorBroadcastScalarToLowRankLowering
return success();
}
- // For 1-d vector, we additionally do a `vectorshuffle`.
auto v =
LLVM::InsertElementOp::create(rewriter, broadcast.getLoc(), vectorType,
poison, adaptor.getSource(), zero);
+ // For 1-d vector, if vector width > 1, we additionally do a
+ // `vector shuffle`
int64_t width = cast<VectorType>(broadcast.getType()).getDimSize(0);
+ if (width == 1) {
+ rewriter.replaceOp(broadcast, v);
+ return success();
+ }
----------------
silee2 wrote:
Added folding pattern for llvm.shufflevector and using createOrFold.
https://github.com/llvm/llvm-project/pull/162946
More information about the Mlir-commits
mailing list