[llvm] [Scalarizer][DirectX] support structs return types (PR #111569)

Tex Riddell via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 14:06:50 PDT 2024


================
@@ -699,6 +730,20 @@ bool ScalarizerVisitor::splitCall(CallInst &CI) {
   if (isVectorIntrinsicWithOverloadTypeAtArg(ID, -1))
     Tys.push_back(VS->SplitTy);
 
+  if (AreAllVectorsOfMatchingSize) {
+    for (unsigned I = 1; I < CallType->getNumContainedTypes(); I++) {
+      if (isVectorIntrinsicWithStructReturnOverloadAtField(ID, I)) {
+        std::optional<VectorSplit> CurrVS = getVectorSplit(
+            cast<FixedVectorType>(CallType->getContainedType(I)));
+        // This case does not seem to happen, but it is possible for
+        // VectorSplit.NumPacked >= NumElems. If that happens a VectorSplit
+        // is not returned and we will bailout of handling this call.
+        if (!CurrVS)
+          return false;
+        Tys.push_back(CurrVS->SplitTy);
+      }
----------------
tex3d wrote:

Oops, I resolved too quickly, as I thought you took the suggestion.

I still think `|| CurrVS->NumPacked != VS->NumPacked` is correct, for the same reason it's checked here:
https://github.com/llvm/llvm-project/blob/709abacdc350d63c61888607edb28ce272daa0a0/llvm/lib/Transforms/Scalar/Scalarizer.cpp#L710-L718

https://github.com/llvm/llvm-project/pull/111569


More information about the llvm-commits mailing list