[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 12:57:15 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``
----------------
nikic wrote:

Looking at this again, shouldn't this be?
```suggestion
  Equivalent to :ref:`align(%align) <attr_align>` on ``%p``, or ``%p + %offset``
```

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


More information about the llvm-commits mailing list