[llvm] [Scalarizer][DirectX] support structs return types (PR #111569)
Tex Riddell via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 12:34:32 PDT 2024
================
@@ -699,6 +730,22 @@ bool ScalarizerVisitor::splitCall(CallInst &CI) {
if (isVectorIntrinsicWithOverloadTypeAtArg(ID, -1))
Tys.push_back(VS->SplitTy);
+ if (AreAllMatchingVectors) {
+ Type *PrevType = CallType->getContainedType(0);
+ for (unsigned I = 1; I < CallType->getNumContainedTypes(); I++) {
+ Type *CurrType = cast<FixedVectorType>(CallType->getContainedType(I));
+ if (PrevType != CurrType) {
----------------
tex3d wrote:
So, this enforces the same component type across all returned vector results, which answers the question in the prior comment: "Should they match the overload type, or can they be different?".
However, I'm not sure it's necessary for them all to have matching component types, is it? Though if they differ in bit width, this could create a problem when using `ScalarizeMinBits` to prevent scalarization of small types, since this could create a different `NumPacked` for different returned results.
This same issue would apply to input arguments, and now that I look at how that's handled, I see the comment that it won't handle it if `NumPacked` for the op is different than for `VS` (returned result).
I think it would be ok to allow different components, as long as incorporating the same check as is used for the operands instead of expecting an exact match in type.
https://github.com/llvm/llvm-project/pull/111569
More information about the llvm-commits
mailing list