[PATCH] D101486: [Dependence Analysis] Enable delinearization of fixed sized arrays

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 22:02:05 PDT 2021


Meinersbur added a comment.

Thanks for the patch.



================
Comment at: llvm/lib/Analysis/DependenceAnalysis.cpp:3354
+    size_t SrcSize = SrcSubscripts.size();
+    for (size_t I = 1; I < SrcSize && !FailedRangeCheck; ++I) {
+      const auto *S = SrcSubscripts[I];
----------------
bmahjour wrote:
> In order to avoid code duplication, you should create a lambda for the code from line 3354 to 3364, parameterize `SrcSize`, `SrcPtr`, and `SrcSubscripts`, and call that lambda twice (once for checking Src* and once for checking Dst*).
A lambda might also useful to have the cleanup code just once. (and make `return` skip all remaining tests)
```
  Check = [] {
    for (...) {
      return false;
    }
    return true;
  };
  if (Check()) {
     ...
     return false;
  }

  SrcSubscripts.clear();
  DstSubscripts.clear();
  return false;
```


================
Comment at: llvm/lib/Analysis/DependenceAnalysis.cpp:3355
+    for (size_t I = 1; I < SrcSize && !FailedRangeCheck; ++I) {
+      const auto *S = SrcSubscripts[I];
+      if (!isKnownNonNegative(S, SrcPtr))
----------------
[style] [[ https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable | Don’t “almost always” use auto ]], except in specific cases.


================
Comment at: llvm/lib/Analysis/DependenceAnalysis.cpp:3367
+    for (size_t I = 1; I < DstSize && !FailedRangeCheck; ++I) {
+      const auto *S = DstSubscripts[I];
+      if (!isKnownNonNegative(S, DstPtr))
----------------
[style] [[ https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable | Don’t “almost always” use auto ]], except in specific cases.


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

https://reviews.llvm.org/D101486



More information about the llvm-commits mailing list