[llvm] [LangRef] Clarify what "group" in invariant.group means. (PR #200552)

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 04:58:37 PDT 2026


================
@@ -8634,6 +8634,12 @@ value (but see the ``llvm.launder.invariant.group`` intrinsic which affects
 when two pointers are considered the same). Pointers returned by bitcast or
 getelementptr with only zero indices are considered the same.
 
+Note that although ``invariant.group`` takes a metadata value (e.g. ``!0`` in
+the code below), that value is meaningless and ignored. (It's present only
----------------
jlebar wrote:

> Isn't this sort of already mentioned above when saying the metadata carries an empty node?

I think the line you refer to was meant to signify what I added here.  But my original read was that the node is empty but the node's identity is the invariant group.

> We could perhaps make the above lines a bit more explicit

Sure, do you like the following better?

> Note that the metadata value in ``invariant.group`` carries no semantic value.  That is, ``invariant.group !0`` and ``invariant.group !1`` mean the same thing.  (The value is present
> because LLVM has no way to attach metadata without referencing an ``MDNode``.)
> The "group" in ``invariant.group`` refers to the pointer SSA value, not to the
> metadata value.

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


More information about the llvm-commits mailing list