[PATCH] D75920: [LoopCacheAnalysis}: Improve cost heuristic.

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 09:39:44 PDT 2020


bmahjour added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LoopCacheAnalysis.h:107
 
+  /// Retrieve the \p Index of the subscript corresponding to the given loop \p
+  /// L. Return true if the subscript index is succesfully located and false
----------------
would be useful to mention that the index is zero-based. ie: "Retrive the zero-based \p Index of the subscript ..."


================
Comment at: llvm/lib/Analysis/LoopCacheAnalysis.cpp:310
+    // If the indexed reference is not 'consecutive' the cost is equal to the
+    // number of iterations associated with the subscript corresponding to the
+    // loop. For example, given the indexed reference 'A[i][j][k]', and assuming
----------------
but in the code below we multiply the trip count for all indexes starting from the given loop up to the loop for the second last subscript.


================
Comment at: llvm/lib/Analysis/LoopCacheAnalysis.cpp:320
+
+    for (unsigned I = Index + 1; I < getNumSubscripts() - 1; ++I) {
+      const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(getSubscript(I));
----------------
why `getNumSubscripts() - 1` instead of just `getNumSubscripts()` ?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75920





More information about the llvm-commits mailing list