This is an archive of the discontinued LLVM Phabricator instance.

Add llvm.codeview.annotation to implement MSVC __annotation
ClosedPublic

Authored by rnk on Aug 18 2017, 3:43 PM.

Details

Summary

This intrinsic represents a label with a list of associated metadata
strings. It is not zero-cost, since it is modelled as reading and
writing memory.

MSVC does not clone annotations when inlining, so we follow suit.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Aug 18 2017, 3:43 PM
rnk retitled this revision from Add llvm.label.annotation to implement MSVC __annotation to Add llvm.codeview.annotation to implement MSVC __annotation.Aug 18 2017, 3:44 PM
majnemer added inline comments.Aug 18 2017, 3:52 PM
llvm/include/llvm/IR/Intrinsics.td
638 ↗(On Diff #111760)
majnemer edited edge metadata.Aug 18 2017, 3:54 PM

I wonder if the right way to model it is with inaccessiblememonly?

rnk added a comment.Aug 18 2017, 5:23 PM

I wonder if the right way to model it is with inaccessiblememonly?

Oh, I forgot about that.

In general, I was just aiming for something conservatively correct that would survive the optimizer at all costs. It should be code generated at most once (so noduplicate). In practice, MSVC removes annotations during inlining, and does not appear to duplicate them in any other way. We could try lambdas or other tricks that force them to double-emit them, though.

rnk edited the summary of this revision. (Show Details)Aug 29 2017, 3:04 PM
rnk updated this revision to Diff 113169.Aug 29 2017, 3:05 PM
rnk edited the summary of this revision. (Show Details)
  • Use inaccessiblememonly
This revision is now accepted and ready to land.Aug 29 2017, 4:10 PM
This revision was automatically updated to reflect the committed changes.