[PATCH] D127835: [SCEV] recognize llvm.annotation intrinsic

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 14:25:11 PDT 2022


Meinersbur added a comment.

In D127835#3584810 <https://reviews.llvm.org/D127835#3584810>, @nikic wrote:

> I would like a LangRef patch to make the wording more explicit. I assume the semantics here are that it's always legal to replace llvm.annotation return value with its argument, but it's preferred not to do the replacement? Otherwise we could just mark the argument as `returned`.

I guess it's like metadata <https://llvm.org/docs/LangRef.html#metadata> but for instructions: Not necessary for semantic correctness, but adds additional information that might be useful, even if just a comment. Its design is unfortunate to have an influence on optimization.

Like D102344 <https://reviews.llvm.org/D102344>, I am ok to greenlight this patch if @nikic is.



================
Comment at: llvm/docs/LangRef.rst:23618-23619
 optimizations that want to look for these annotations. These have no
-other defined use; they are ignored by code generation and optimization.
+other defined use; they are replaced with their first operand in instruction
+selection passes and in all other transformations and analysis.
 
----------------
This sounds like they are removed immediately (even by analyses?), but its just that it is semantically correct to do so while losing some information such as debug info.

Could you use wording such as "transformations preserve annotations on a best-effort basis but are allowed to replace them with their first argument without breaking semantics and are completely dropped during instruction selection"?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127835



More information about the llvm-commits mailing list