[llvm] [IR] Remove pointer arguments from loop.dependence.{war|raw}.mask (PR #188248)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 27 01:30:59 PDT 2026


================
@@ -25021,66 +25020,73 @@ This is an overloaded intrinsic.
 
 ::
 
-      declare <4 x i1> @llvm.loop.dependence.war.mask.v4i1(ptr %ptrA, ptr %ptrB, i64 immarg %elementSize)
-      declare <8 x i1> @llvm.loop.dependence.war.mask.v8i1(ptr %ptrA, ptr %ptrB, i64 immarg %elementSize)
-      declare <16 x i1> @llvm.loop.dependence.war.mask.v16i1(ptr %ptrA, ptr %ptrB, i64 immarg %elementSize)
-      declare <vscale x 16 x i1> @llvm.loop.dependence.war.mask.nxv16i1(ptr %ptrA, ptr %ptrB, i64 immarg %elementSize)
+      declare <4 x i1> @llvm.loop.dependence.war.mask.v4i1.i64(i64 %pointerDiff, i64 immarg %elementSize)
+      declare <8 x i1> @llvm.loop.dependence.war.mask.v8i1.i32(i32 %pointerDiff, i64 immarg %elementSize)
+      declare <16 x i1> @llvm.loop.dependence.war.mask.v16i1.i64(i64 %pointerDiff, i64 immarg %elementSize)
+      declare <vscale x 16 x i1> @llvm.loop.dependence.war.mask.nxv16i1.i64(i64 %pointerDiff, i64 immarg %elementSize)
 
 
 Overview:
 """""""""
 
-Given a vector load from %ptrA followed by a vector store to %ptrB, this
-instruction generates a mask where an active lane indicates that the
-write-after-read sequence can be performed safely for that lane, without the
-danger of a write-after-read hazard occurring.
+For a given pointer difference between a vector load and a vector store
+(i.e., `%storePointer - %loadPointer`), where the load occurs before the store,
+this instruction generates a mask where active lanes indicate a write-after-read
+sequence can be performed safely.
 
-A write-after-read hazard occurs when a write-after-read sequence for a given
-lane in a vector ends up being executed as a read-after-write sequence due to
-the aliasing of pointers.
+Lanes are inactive when a write-after-read hazard may occur, which happens when
+the load of a lane depends on a value that has yet to be written. See below for
+examples.
 
 Arguments:
 """"""""""
 
-The first two arguments are pointers and the last argument is an immediate.
-The result is a vector with the i1 element type.
+The first argument is a signed pointer difference. The second argument is an
+immediate describing the element size in bytes.
+
+The result is a vector with an i1 element type.
 
 Semantics:
 """"""""""
 
-``%elementSize`` is the size of the accessed elements in bytes.
-The intrinsic returns ``poison`` if the distance between ``%prtA`` and ``%ptrB``
-is smaller than ``VF * %elementsize`` and either ``%ptrA + VF * %elementSize``
-or ``%ptrB + VF * %elementSize`` wrap.
+``%elementSize`` is the size of the accessed elements in bytes. It is assumed
+both the load and store use the same vector type.
+
+The intrinsic returns ``poison`` if ``%pointerDiff`` is not a multiple of
+``%elementSize``.
----------------
MacDue wrote:

If not, the current expansions are also wrong (and would need a bunch of edge case handling). 

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


More information about the llvm-commits mailing list