[PATCH] D32998: [SROA] enable splitting for non-whole-alloca loads and stores

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 23:37:51 PDT 2017


inouehrs marked 3 inline comments as done.
inouehrs added inline comments.


================
Comment at: lib/Transforms/Scalar/SROA.cpp:3978
       continue;
-    // FIXME: We currently leave whole-alloca splittable loads and stores. This
-    // used to be the only splittable loads and stores and we need to be
-    // confident that the above handling of splittable loads and stores is
-    // completely sufficient before we forcibly disable the remaining handling.
-    if (S.beginOffset() == 0 &&
-        S.endOffset() >= DL.getTypeAllocSize(AI.getAllocatedType()))
-      continue;
+    if (all_of(AS, [S](Slice &S2) {
+      if (S == S2) return true;
----------------
rnk wrote:
> Does this have to be n^2 in the number of slices? Can't you leverage the sorting to be more efficient?
I changed the algorithm to a linear-time one. I confirmed that this algorithm generates the same results to the previous N^2 algorithm during the bootstrap test.




================
Comment at: test/Transforms/SROA/basictest.ll:1707-1709
+; CHECK      %[[shift:.*]] = lshr i64 %v, 32
+; CHECK-next %{{.*}} = trunc i64 %[[shift]] to i32
+; CHECK-next ret void
----------------
jroelofs wrote:
> rnk wrote:
> > These CHECKs have no colon, they aren't firing.
> Also, the `NEXT` must be capitalized.
Thank you so much for pointing this out. Fixed these errors.


https://reviews.llvm.org/D32998





More information about the llvm-commits mailing list