This is an archive of the discontinued LLVM Phabricator instance.

Enhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst
ClosedPublic

Authored by junbuml on Dec 11 2015, 2:00 PM.

Details

Summary

When identifying blocks post-dominated by an unreachable-terminated block
in BranchProbabilityInfo, consider only the edge to the normal destination
block if the terminator is InvokeInst and let calcInvokeHeuristics() decide
edge weights for the InvokeInst.

Diff Detail

Event Timeline

junbuml updated this revision to Diff 42569.Dec 11 2015, 2:00 PM
junbuml retitled this revision from to Enhance BranchProbabilityInfo::calcUnreachableHeuristics for InvokeInst.
junbuml updated this object.
davidxl added inline comments.Dec 11 2015, 2:57 PM
lib/Analysis/BranchProbabilityInfo.cpp
126

Is it better to move the new logic here in the same place?

157

It seems there is no need to return false here -- the code following will handle it just ok. Inserting BB into PostDomByUnreachable is good enough

davidxl accepted this revision.Dec 11 2015, 5:56 PM
davidxl edited edge metadata.

This is a nice improvement -- this change looks good to me.

lib/Analysis/BranchProbabilityInfo.cpp
126

Actually I meant line 142 -- but it is probably not cleaner.

157

discard this comment -- though it does not matter what successor BPs are when the BB's weight is zero, it is still better to use the heurisitic later.

This revision is now accepted and ready to land.Dec 11 2015, 5:56 PM
junbuml updated this revision to Diff 42877.Dec 15 2015, 10:42 AM
junbuml edited edge metadata.

Fixed the failure in catchret-empty-fallthrough.ll

The test case change looks correct to me -- the return should be the fall through.

junbuml closed this revision.Dec 18 2015, 1:01 PM

Landed in r256028.

Thank you so much for the review !