[llvm] [LV] Add initial support for vectorizing literal struct return values (PR #109833)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 05:28:06 PST 2024
================
@@ -946,8 +946,8 @@ bool LoopVectorizationLegality::canVectorizeInstrs() {
// 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()) ||
+ Type *InstTy = I.getType();
+ if (!(InstTy->isVoidTy() || canWidenType(InstTy)) ||
----------------
david-arm wrote:
The possible problem I see here is that we're assuming that we can vectorise any arbitrary operation that returns a structure, which in practice may not be true because this patch is currently only testing the case of call instructions. @MacDue have you tested this patch to see what happens on IR like this?
```
%load = load { i32, i32 }, ptr %gep.A, align 4
```
to see how the vectoriser handles it with your patch? I suspect that if we choose to go with this version of your patch we probably want to restrict struct returns to calls for now.
https://github.com/llvm/llvm-project/pull/109833
More information about the llvm-commits
mailing list