[llvm] [Scalarizer][DirectX] support structs return types (PR #111569)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 09:06:53 PDT 2024
================
@@ -197,6 +197,23 @@ struct VectorLayout {
uint64_t SplitSize = 0;
};
+static bool isStructAllVectors(Type *Ty) {
+ if (!isa<StructType>(Ty))
+ return false;
+ if (Ty->getNumContainedTypes() < 1)
+ return false;
+ FixedVectorType *VecTy = dyn_cast<FixedVectorType>(Ty->getContainedType(0));
+ if (!VecTy)
+ return false;
+ unsigned VecSize = VecTy->getNumElements();
+ for (unsigned I = 1; I < Ty->getNumContainedTypes(); I++) {
----------------
bogner wrote:
Generally best to cache the size here rather than call a function every iteration
```suggestion
for (unsigned I = 1, E = Ty->getNumContainedTypes(); I != E; I++) {
```
https://github.com/llvm/llvm-project/pull/111569
More information about the llvm-commits
mailing list