[BOLT] Fix issue printing CTCs without annotations

Summary:
After stripping annotations, conditional tail calls no longer can be
identified by their corresponding tag. We can check the number of basic
block successors instead.

Fixes facebookincubator/BOLT#58.

(cherry picked from FBD16444718)
This commit is contained in:
Maksim Panchenko 2019-07-22 20:57:19 -07:00
parent fde5a2b470
commit 2c9c6b164b
1 changed files with 3 additions and 2 deletions

View File

@ -222,8 +222,9 @@ DynoStats getDynoStats(const BinaryFunction &BF) {
continue;
}
// CTCs
if (BC.MIB->getConditionalTailCall(*CondBranch)) {
// CTCs: instruction annotations could be stripped, hence check the number
// of successors to identify conditional tail calls.
if (BB->succ_size() == 1) {
if (BB->branch_info_begin() != BB->branch_info_end())
Stats[DynoStats::UNCOND_BRANCHES] += BB->branch_info_begin()->Count;
continue;