'!annotation' type metadata and compiler optimisations

Hi all,

I was looking for a mechanism for tracking instructions through compiler
optimisations, i.e. annotate before optimisations and check again after
optimisations.

Am I correct in understanding that '!annotation' type metadata is, by design,
guaranteed to be left untouched by compiler optimisations if its corresponding
instruction doesn't get optimised away?

Many thanks,
Paul

Hi all,

I was looking for a mechanism for tracking instructions through compiler
optimisations, i.e. annotate before optimisations and check again after
optimisations.

Am I correct in understanding that '!annotation' type metadata is, by design,
guaranteed to be left untouched by compiler optimisations if its corresponding
instruction doesn't get optimised away?

You should be able to use !annotation metadata for this use case.

But preserving !annotation is done one a best effort basis, like for all other metadata kinds. So depending on your use case you might have to track down and update passes that remove it unnecessarily.

Cheers Florian