[PATCH] D143225: [SROA] Create additional vector type candidates based on store and load slices

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 22:00:05 PST 2023


mingmingl added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:1952-1959
+    LoadStoreTys.insert(Ty);
+    // Consider any loads or stores that are the exact size of the slice.
+    if (S.beginOffset() == P.beginOffset() && S.endOffset() == P.endOffset())
+      CheckCandidateType(Ty);
+  }
+  // Consider additional vector types where the element type size is a
+  // multiple of load/store element size.
----------------
zhuhan0 wrote:
> mingmingl wrote:
> > (Take the liberty to chime in for my understanding)
> > Here `Ty` is inserted even if it doesn't have the exact size with `P`. Does it mean (in this patch) that slices (`S`) are considered for vector SROA even if it has different size than `P`?
> This `Ty` is not a candidate type. It's a type that shows up in load or store instructions and it'll be used later for considering other types. For example, if one `Ty` is `i16` and there is one candidate type `<2 x i32>`, the inner loop will be able to add another candidate type `<4 x i16>`. Slices are still only considered if they have the same size as P, because only two places insert candidate types and they both enforce such requirement (line 1954 - 1955 and 1969 - 1970.
many thanks for the example! Running this over https://godbolt.org/z/1rqGd9z3E and was able to understand how it helps (basically having more candidates vector types for `checkVectorTypeForPromotion`, not only the vector types seen in original partition slices). 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143225/new/

https://reviews.llvm.org/D143225



More information about the llvm-commits mailing list