This is an archive of the discontinued LLVM Phabricator instance.

[BranchProbabilityInfo] Get rid of MaxSuccIdx. NFC
ClosedPublic

Authored by yrouban on Nov 5 2020, 4:27 AM.

Details

Summary

This refactoring allows to eliminate the MaxSuccIdx map proposed in D90272.
The idea is to remove probabilities for a block BB for all its successors one by one from first, second, ... till N-th until they are defined in Probs. This works because probabilities for the block are set at once for all its successors from number 0 to N-1 and the rest are removed if there were stale probs.
I propose to remove the protected method setEdgeProbability(), which sets probabilities for individual successors, to make it clear that they are set in bulk in the public method with the same name.

Diff Detail

Event Timeline

yrouban created this revision.Nov 5 2020, 4:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2020, 4:27 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
yrouban requested review of this revision.Nov 5 2020, 4:27 AM
kazu accepted this revision.Nov 5 2020, 11:18 AM

Thank you for cleaning this up.

llvm/lib/Analysis/BranchProbabilityInfo.cpp
1176

s/exist/exists/

1176

s/numbers/indexes/

1178

How about removing the public method because we now have only one setEdgeProbability?

This revision is now accepted and ready to land.Nov 5 2020, 11:18 AM
MaskRay accepted this revision.Nov 5 2020, 11:33 AM

LGTM.

llvm/lib/Analysis/BranchProbabilityInfo.cpp
1180

Nit: delete true

1183

find -> count == 0

This revision was landed with ongoing or failed builds.Nov 5 2020, 9:22 PM
This revision was automatically updated to reflect the committed changes.
yrouban marked 5 inline comments as done.