[PATCH] D58147: [CodeGen] Fix calling llvm.var.annotation outside of a basic block.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 26 15:52:19 PST 2019


vsapsai added a comment.

In D58147#1398094 <https://reviews.llvm.org/D58147#1398094>, @rjmccall wrote:

> Okay.  Is it acceptable for the annotation to simply disappear in this case?  I don't really understand the purposes of annotations well enough to judge.


Looks like it is acceptable. The main justification for this behavior is that it is already happening for

  return;
  int after_return = __builtin_annotation(0, "annotation");

so I think it is correct to have the same IR for

  return;
  int after_return __attribute__((annotate("annotation"))) = 0;

Also looks like in the code we don't really use this intrinsic. And according to the documentation

> This intrinsic allows annotation of local variables with arbitrary
>  strings. This can be useful for special purpose optimizations that want
>  to look for these annotations. These have no other defined use; they are
>  ignored by code generation and optimization.

I think for the special purpose optimizations it would be more convenient not to know about the code after return instead of detecting it and ignoring explicitly.


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

https://reviews.llvm.org/D58147





More information about the cfe-commits mailing list