This is an archive of the discontinued LLVM Phabricator instance.

[IR] Convert profile metadata in createCallMatchingInvoke()
ClosedPublic

Authored by yrouban on Jun 17 2020, 11:59 PM.

Details

Summary

When an invoke instruction is converted to a call its profile metadata is dropped because it has incompatible format (see https://reviews.llvm.org/D81996).
This patch adds an attempt to convert profile data to format of the call instruction. This used to work well before the patch https://reviews.llvm.org/D80618.

Diff Detail

Event Timeline

yrouban created this revision.Jun 17 2020, 11:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 18 2020, 12:00 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
hans added a comment.Jun 18 2020, 3:39 AM

Seems reasonable, but I don't know that much about profile info.. is it actually useful to have "branch_weights" metadata on a call? Isn't it enough that there's profile info on the branch towards the BB that has the call instruction? Or is this data used for something more?

Seems reasonable, but I don't know that much about profile info.. is it actually useful to have "branch_weights" metadata on a call? Isn't it enough that there's profile info on the branch towards the BB that has the call instruction? Or is this data used for something more?

Branch_weights are useful for call instructions as said in the LLVM LangRef (https://llvm.org/docs/BranchWeightMetadata.html).
Let us wait for @xur to comment.

hans added a comment.Jun 18 2020, 6:43 AM

Branch_weights are useful for call instructions as said in the LLVM LangRef (https://llvm.org/docs/BranchWeightMetadata.html).
Let us wait for @xur to comment.

That doc initially says branch weights are only used on terminators, although I see call instructions mentioned further down. It would be good to get it updated :-)

reames accepted this revision.Jun 19 2020, 9:30 PM
reames added a subscriber: reames.

LGTM

(Just for reference, the total bit tripped me up at first, but the reasoning is that we're converting to a call, not proving the call no throw. We could still throw out.)

We probably should extend the call metadata to the two argument form to explicitly model the difference between normal and throw out.

This revision is now accepted and ready to land.Jun 19 2020, 9:30 PM
This revision was automatically updated to reflect the committed changes.