This is an archive of the discontinued LLVM Phabricator instance.

[BranchProbabilityInfo] Remove block handles in eraseBlock()
ClosedPublic

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

Details

Summary

BranchProbabilityInfo::eraseBlock() is a public method and can be called without deleting the block itself.
I believe this method should remove the correspondent tracking handle from BranchProbabilityInfo::Handles along with the probabilities of the block. So I propose to move Handles.erase() call to eraseBlock().
In setEdgeProbability() we need to add the block handle only once.

Diff Detail

Event Timeline

yrouban created this revision.Nov 5 2020, 4:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2020, 4:39 AM
yrouban requested review of this revision.Nov 5 2020, 4:39 AM
yrouban set the repository for this revision to rG LLVM Github Monorepo.Nov 5 2020, 4:50 AM
kazu accepted this revision.Nov 5 2020, 2:23 PM

LGTM. Thanks!

llvm/include/llvm/Analysis/BranchProbabilityInfo.h
216

While you are at this, could you make BranchProbabilityInfo::Handles private?

This revision is now accepted and ready to land.Nov 5 2020, 2:23 PM
yrouban added inline comments.Nov 5 2020, 9:50 PM
llvm/include/llvm/Analysis/BranchProbabilityInfo.h
216

It is private.

kazu added inline comments.Nov 5 2020, 10:07 PM
llvm/include/llvm/Analysis/BranchProbabilityInfo.h
216

Sorry, I missed that. Thank you for checking!