[PATCH] D29517: This patch adds a predicateinfo intrinsic, as part of splitting up D29316.

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 14:35:03 PST 2017

dberlin created this revision.

The intrinsic, marked as returning it's first argument, has no code
generation effect (though currently not every optimization pass knows
that intrinsics with the returned attribute can be looked through).

It is used to attach predicate information to existing operands, and
be able to tell what the predicate information affects.

We deliberately do not attach any info through a second operand so
that the intrinsics do not need to dominate the comparisons/etc (since
in the case of assume, we may want to push them up the post-dominator



Index: include/llvm/IR/Intrinsics.td
--- include/llvm/IR/Intrinsics.td
+++ include/llvm/IR/Intrinsics.td
@@ -781,6 +781,10 @@
                                  [IntrArgMemOnly, NoCapture<0>, NoCapture<1>,
                                   WriteOnly<0>, ReadOnly<1>]>;
+//===----- Intrinsics that are used to provide predicate information -----===//
+def int_predicateinfo : Intrinsic<[llvm_any_ty], [LLVMMatchType<0>],
+				  [IntrNoMem, Returned<0>]>;
 // Target-specific intrinsics
Index: docs/LangRef.rst
--- docs/LangRef.rst
+++ docs/LangRef.rst
@@ -12684,6 +12684,43 @@
 that the optimizer can otherwise deduce or facts that are of little use to the
+.. _int_predicateinfo:
+'``llvm.predicateinfo``' Intrinsic
+      declare type @llvm.predicateinfo(type %operand) returned(1) readnone
+The first argument is an operand to which predicate info is attached.
+The ``llvm.predicateinfo`` intrinsic is used to attach information to
+operations used in comparisons, as well as to the results of those
+comparisons.  It is a copy operation used to build Extended SSA form,
+and so is placed at the beginning of blocks dominated by the true or
+false edges of branches, as well as blocks that are post-dominated by
+assume operations.
+For operations used in branch comparisons, the information attached to
+the intrinsic includes which edge direction the current block is
+dominated by (true or false), as well as the original comparison. For
+assumes, the information attached includes a pointer to the assume
+The PredicateInfo analysis can be used to retrieve the attached
+information.  The intrinsic has no code-generation effect, and always
+returns the first argument from the perspective of the optimizer.
 .. _type.test:
 '``llvm.type.test``' Intrinsic

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29517.87029.patch
Type: text/x-patch
Size: 2224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170203/fba50edc/attachment.bin>

More information about the llvm-commits mailing list