================
@@ -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;
+ indices.reserve(oldNumElements);
+ for (unsigned i = 0; i < oldNumElements; i++) {
----------------
andykaylor wrote:
No need for braces here.
https://github.com/llvm/llvm-project/pull/161232
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits