[clang] [CIR] Implement handling for VectorType with size 3 (PR #161232)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 29 14:57:12 PDT 2025
================
@@ -565,13 +580,31 @@ mlir::Value CIRGenFunction::emitLoadOfScalar(Address addr, bool isVolatile,
return nullptr;
}
- const auto vecTy = cast<cir::VectorType>(eltTy);
+ // Handles vectors of sizes that are likely to be expanded to a larger size
+ // to optimize performance.
+ auto vecTy = cast<cir::VectorType>(eltTy);
+ cir::VectorType newVecTy =
+ cgm.getTargetCIRGenInfo().getABIInfo().getOptimalVectorMemoryType(
+ vecTy, getLangOpts());
+
+ if (vecTy != newVecTy) {
+ Address cast = addr.withElementType(builder, newVecTy);
+ mlir::Value value = builder.createLoad(cgm.getLoc(loc), cast, isVolatile);
+
+ unsigned oldNumElements = vecTy.getSize();
+ SmallVector<mlir::Attribute, 8> indices;
----------------
andykaylor wrote:
```suggestion
SmallVector<mlir::Attribute> indices;
```
https://github.com/llvm/llvm-project/pull/161232
More information about the cfe-commits
mailing list