[PATCH] D74209: [AssumeBundle] Add documentation for the operand bundles of an llvm.assume

Tyker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 06:57:36 PST 2020


Tyker updated this revision to Diff 243447.
Tyker marked 4 inline comments as done.
Tyker retitled this revision from "[AssumeBundle] Add documentation for assume operand bundles" to "[AssumeBundle] Add documentation for the operand bundles of an llvm.assume".
Tyker edited the summary of this revision.
Tyker added a comment.

tried to fix/improve formulations


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74209/new/

https://reviews.llvm.org/D74209

Files:
  llvm/docs/LangRef.rst


Index: llvm/docs/LangRef.rst
===================================================================
--- llvm/docs/LangRef.rst
+++ llvm/docs/LangRef.rst
@@ -2102,6 +2102,52 @@
 generated code.  For more details, see :ref:`GC Transitions
 <gc_transition_args>`.
 
+.. _assume_opbundles:
+
+Assume Operand Bundles
+^^^^^^^^^^^^^^^^^^^^^^
+
+Operand bundles on an :ref:`llvm.assume <int_assume>` allows representing
+assumptions that an attribute holds for a certain value at a certain position.
+This allows representing assumptions that are either hard or not possible to
+represent as a boolean argument of an :ref:`llvm.assume <int_assume>`.
+
+* The tag of the operand bundle is the attribute that can be assumed to hold.
+* The first argument if present is the value for which the attribute hold.
+* The Second argument if present is an argument of the attribute.
+
+If there are no arguments the attribute is a property of the path.
+
+For example:
+
+.. code-block:: llvm
+
+      call void @llvm.assume(i1 true) ["align"(i32* %val, i32 8)]
+
+allows the optimizer to assume that ``%val`` has an alignment of at least 8
+at this point.
+
+.. code-block:: llvm
+
+      call void @llvm.assume(i1 true) ["cold"()]
+
+allows the optimizer to assume that the path is cold.
+
+If any of the provided guarantees are incorrect the behavior is undefined.
+
+Even if the property can be represented as a boolean property like ``nonnull``.
+Using operand bundles to express the property still have benefits:
+
+* Attributes that can be expressed via operand bundles are directly the
+  property that the optimizer uses and cares about. Encoding attributes as
+  operand bundles removes the need for an instruction sequence that represents
+  the property (e.g., `icmp ne i32* %p, null` for `nonnull`) and for the
+  optimizer to deduce the property from that instruction sequence.
+* Expressing the property using operand bundles makes it easy to identify the
+  use of the value as a use in an :ref:`llvm.assume <int_assume>`. This then
+  simplifies and improves heuristics, e.g., for use "use-sensitive"
+  optimizations.
+
 .. _moduleasm:
 
 Module-Level Inline Assembly
@@ -17532,10 +17578,14 @@
 condition is true. This information can then be used in simplifying other parts
 of the code.
 
+For operand bundles on an ``llvm.assume`` see
+:ref:`assume operand bundles <assume_opbundles>`.
+
 Arguments:
 """"""""""
 
-The condition which the optimizer may assume is always true.
+The argument of the call is the condition which the optimizer may assume is
+always true.
 
 Semantics:
 """"""""""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74209.243447.patch
Type: text/x-patch
Size: 2594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200209/4341decd/attachment.bin>


More information about the llvm-commits mailing list