[llvm] [IR] Reject unhandled assume bundles and seperate them from normal attributes (PR #197007)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 05:48:26 PDT 2026
================
@@ -3127,33 +3136,57 @@ Assume Operand Bundles
^^^^^^^^^^^^^^^^^^^^^^
Operand bundles on an :ref:`llvm.assume <int_assume>` allow representing
-assumptions, such as that a :ref:`parameter attribute <paramattrs>` or a
-:ref:`function attribute <fnattrs>` holds for a certain value at a certain
-location. Operand bundles enable assumptions that are either hard or impossible
-to represent as a boolean argument of an :ref:`llvm.assume <int_assume>`.
+assumptions that hold at the location of the assume. Operand bundles enable
+assumptions that are either hard or impossible to represent as a boolean
+argument of an :ref:`llvm.assume <int_assume>`.
Assumes with operand bundles must have ``i1 true`` as the condition operand.
-An assume operand bundle has the form:
+Just like for the argument of :ref:`llvm.assume <int_assume>`, if any of the
+provided guarantees are violated at runtime the behavior is undefined.
-::
+While attributes expect constant arguments, assume operand bundles may be
+provided a dynamic value, for example:
- "<tag>"([ <arguments>] ])
+.. code-block:: llvm
-In the case of function or parameter attributes, the operand bundle has the
-restricted form:
+ call void @llvm.assume(i1 true) ["align"(ptr %val, i32 %align)]
-::
+The following attributes are currently accepted:
+
+``"align"(ptr %p, i64 %align)``, ``"align"(ptr %p, i64 %align, i64 %offset)``
+ Equivalent to :ref:`align(%align) <attr_align>` on ``%p``, or ``%p - %offset``
+ if the ``%offset`` argument exists, except that ``%align`` may be a
+ non-power-of-two alignment (including a zero alignment). If ``%align`` is not
+ a power of two the pointer value must be all-zero. Otherwise the behavior is
+ undefined.
+
+``"cold"()``
+ Equivalent to :ref:`cold <attr_cold>`.
+
+``"dereferenceable"(ptr %p, i64 %size)``
+ Equivalent to :ref:`dereferenceable(%size) <attr_dereferenceable>` on ``%p``,
+ except that ``%size`` may also be zero, in which case the attribute doesn't
----------------
nikic wrote:
```suggestion
except that ``%size`` may also be zero, in which case the bundle doesn't
```
https://github.com/llvm/llvm-project/pull/197007
More information about the llvm-commits
mailing list