[llvm] [LSROA] Support arrays, vectors, and nested structs (PR #218846)

Deric C. via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 19:59:29 PDT 2026


================
@@ -113,27 +110,72 @@ static bool isAllocaSplittable(StructuredAllocaInst &SAI) {
   return true;
 }
 
-// Returns a vector with one element for each field of the struct allocated by
-// SAI. Each element is a vector of SGEP instruction referencing this field.
-// This function ignores lifetime intrinsics.
-static SmallVector<SmallVector<StructuredGEPInst *>>
-collectPerFieldSGEP(StructuredAllocaInst &SAI) {
-  StructType *ST = cast<StructType>(SAI.getAllocationType());
-  SmallVector<SmallVector<StructuredGEPInst *>> Output(ST->getNumElements());
-
-  for (User *U : SAI.users()) {
-    if (isa<LifetimeIntrinsic>(U))
+namespace {
+struct FieldSGEPs {
+  /// All GEPs that access this specific field.
+  SmallVector<StructuredGEPInst *, 1> SGEPs;
+  /// Type of the access.
----------------
Icohedron wrote:

[SUGGESTION] I think this comment could be made more precise about what type it is referring to.
```suggestion
  /// Type of the field that the shared indices reach.
```

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


More information about the llvm-commits mailing list