[llvm] [LangRef] Fix inequalities and add examples for `loop.dependence.*.mask` (PR #170861)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 03:59:12 PST 2025


================
@@ -24486,10 +24487,46 @@ Examples:
       [...]
       call @llvm.masked.store.v4i32.p0v4i32(<4 x i32> %vecA, ptr align 4 %ptrB, <4 x i1> %loop.dependence.mask)
 
+      ; For the above example, consider the following cases:
+      ;
+      ; 1. ptrA >= ptrB
+      ;
+      ;   load =      <0,1,2,3>     ; uint32_t load = array[i+2];
+      ;  store =  <0,1,2,3>         ; array[i] = store;
+      ;
+      ; This results in an all-true mask, as the load always occurs before the
+      ; store, so it does not depend on any values to be stored.
+      ;
+      ; 2. ptrB - ptrA = elementSize:
+      ;
+      ;   load =  <0,1,2,3>         ; uint32_t load = array[i];
+      ;  store =    <0,1,2,3>       ; array[i+1] = store;
+      ;
+      ; This results in a mask with only the first lane active. This is because
+      ; we can only read one lane before we would read values that have yet to
+      ; be written.
+      ;
----------------
sdesmalen-arm wrote:

nit: I don't see much advantage of this example over example (3).

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


More information about the llvm-commits mailing list