This is an archive of the discontinued LLVM Phabricator instance.

[WIP][Attributor] AAHotCold Use CFG to propagate hot cold.
Needs ReviewPublic

Authored by kuter on Aug 12 2021, 8:09 PM.

Details

Summary

This patch makes it possible to propagate hot cold across basic
blocks with in the attributes. It relies on the BranchProbabilityInfo
to check if a edge is hot or cold.

The hot cold information is propagated both to successors and to
predecessors.

Diff Detail

Event Timeline

kuter created this revision.Aug 12 2021, 8:09 PM
kuter requested review of this revision.Aug 12 2021, 8:09 PM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
jdoerfert added inline comments.Aug 16 2021, 11:20 PM
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
9728

I don't like the true => hot, false = cold encoding. We should make it explicit.

How does the backwards traversal change anything here? I can see how it might if we do more in Propagate.
Also, we should not walk the CFG twice. WDYT about one of the following two:

  1. Keep a list of blocks for which we actually want to know hot/cold information. We want to know if there is a call site for which we want to know, and then transitively other blocks around if possible, or
  2. Expand from known information. So we use some sources of hotness and only look at the blocks for which we have a hot/cold annotation and try to add more to the set.
kuter updated this revision to Diff 367373.Aug 18 2021, 5:43 PM

rebase, fix tests, change propagation technique.
I will add a test.

ormris removed a subscriber: ormris.Jan 24 2022, 11:47 AM