This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Preserve !annotation on newly created instructions.
ClosedPublic

Authored by fhahn on Nov 13 2020, 9:49 AM.

Details

Summary

If the source instruction has !annotation metadata, all instructions
created during combining should also have it. Tell the builder to
add it.

The !annotation system was discussed on llvm-dev as part of
'RFC: Combining Annotation Metadata and Remarks'
(http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)

This patch is based on an earlier patch by Francis Visoiu Mistrih.

Diff Detail

Event Timeline

fhahn created this revision.Nov 13 2020, 9:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2020, 9:49 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn requested review of this revision.Nov 13 2020, 9:49 AM

Can you please add a link to the patches/maillist disscussions about said annotation?
What about teaching IRBuilder to deal with it like it deals with debugloc?

fhahn edited the summary of this revision. (Show Details)Nov 13 2020, 10:19 AM

Can you please add a link to the patches/maillist disscussions about said annotation?
What about teaching IRBuilder to deal with it like it deals with debugloc?

Sure, I updated the description.

The !annotation system was discussed on llvm-dev as part of 'RFC: Combining Annotation Metadata and Remarks' (http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)

thegameg added inline comments.Nov 13 2020, 3:47 PM
llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
1105

Why not copyMetadata here?

fhahn updated this revision to Diff 312216.Dec 16 2020, 7:57 AM

What about teaching IRBuilder to deal with it like it deals with debugloc?

Done! Together with D93400 this patch now boils down to requesting !annotation to be preserved for instructions created by IRBuilder.

Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2020, 7:57 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
thegameg accepted this revision.Dec 16 2020, 11:06 AM

LGTM, nice!

This revision is now accepted and ready to land.Dec 16 2020, 11:06 AM
lebedev.ri accepted this revision.Dec 16 2020, 11:09 AM

What about teaching IRBuilder to deal with it like it deals with debugloc?

Done! Together with D93400 this patch now boils down to requesting !annotation to be preserved for instructions created by IRBuilder.

Yay, now this does look good to me.
Thanks.

fhahn retitled this revision from [InstCombine] Preserve !annotation metadata for memory combines. to [InstCombine] Preserve !annotation on newly created instructions..Dec 17 2020, 6:40 AM
fhahn edited the summary of this revision. (Show Details)
This revision was landed with ongoing or failed builds.Dec 17 2020, 7:21 AM
This revision was automatically updated to reflect the committed changes.