[PATCH] D108371: [LAA] Add Memory dependence and unknown bounds remarks.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 6 04:57:26 PDT 2021


fhahn added a comment.

In D108371#2976665 <https://reviews.llvm.org/D108371#2976665>, @malharJ wrote:

> @fhahn , but these remarks are specific to vectorization (ie. scenarios where loop does not get vectorized) ...
>  are there any passes (other than LV) which would require this information ?

Thanks for the update. As David already said, other passes also use LAA and also there's nothing vectorisation specific about the remark you added.



================
Comment at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:261
 
+  const SmallVector<Dependence, 2> &getUnsafeDependences() const {
+    return UnsafeDependences;
----------------
There's no need to return a SmallVector with the length encoded, the callers should not care about that. You can use ArrayRef if the callers do not add to the vector or SmalLVectorImpl if they need to add elements.


================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:590
+  //
+  // Used when emitting unknown_array_bounds remark.
+  SmallPtrSet<Value *, 4> UncomputablePtrs;
----------------
Use `///` for all comments. Also, does this need to be public after the recent changes?


================
Comment at: llvm/lib/Analysis/LoopAccessAnalysis.cpp:1721
 
+            // Runtime checks are only feasible, if all unsafe dependencies are
+            // unknown. For other unsafe deps, we already know they will fail
----------------
Why call it `UnsafeDependences` if it is supposed to only contain unknown dependences?


================
Comment at: llvm/test/Transforms/LoopVectorize/loopvectorize-opt-remarks.ll:1
+; RUN: opt -enable-new-pm=0 -loop-vectorize -analyze -pass-remarks-analysis=loop-accesses < %s 2>&1 | FileCheck %s
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
----------------
please avoid adding tests with `-enable-new-pm=0`. You should be able to move that one to the LoopAccessAnalysis directory.


================
Comment at: llvm/test/Transforms/LoopVectorize/loopvectorize-opt-remarks.ll:6
+; void test_unknown_bounds(int* A, int* B, int n) {
+;     for(int i = 0; i < n ; ++i)
+;         A[i] = A[B[i]] + 1;
----------------
Instead of having the C code here, I think it would be more helpful if you explain what this tests in a sentence or 2 with references to the IR, e.g. which memory instruction/GEP has the uncomputable bound and *why*.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108371



More information about the llvm-commits mailing list