diff --git a/bolt/BinaryFunction.cpp b/bolt/BinaryFunction.cpp index 9c688918d0cf..ed40e059f7b5 100644 --- a/bolt/BinaryFunction.cpp +++ b/bolt/BinaryFunction.cpp @@ -2688,6 +2688,20 @@ DynoStats BinaryFunction::getDynoStats() const { Stats[DynoStats::FUNCTION_CALLS] += BBExecutionCount; if (BC.MIA->getMemoryOperandNo(Instr) != -1) { Stats[DynoStats::INDIRECT_CALLS] += BBExecutionCount; + } else if (const auto *CallSymbol = BC.MIA->getTargetSymbol(Instr)) { + if (BC.getFunctionForSymbol(CallSymbol)) + continue; + auto GSI = BC.GlobalSymbols.find(CallSymbol->getName()); + if (GSI == BC.GlobalSymbols.end()) + continue; + auto Section = BC.getSectionForAddress(GSI->second); + if (!Section) + continue; + StringRef SectionName; + Section->getName(SectionName); + if (SectionName == ".plt") { + Stats[DynoStats::PLT_CALLS] += BBExecutionCount; + } } } diff --git a/bolt/BinaryFunction.h b/bolt/BinaryFunction.h index 13f31e632882..ecee06d30753 100644 --- a/bolt/BinaryFunction.h +++ b/bolt/BinaryFunction.h @@ -64,6 +64,7 @@ class DynoStats { D(UNCOND_BRANCHES, "executed unconditional branches", Fn)\ D(FUNCTION_CALLS, "all function calls", Fn)\ D(INDIRECT_CALLS, "indirect calls", Fn)\ + D(PLT_CALLS, "PLT calls", Fn)\ D(INSTRUCTIONS, "executed instructions", Fn)\ D(JUMP_TABLE_BRANCHES, "taken jump table branches", Fn)\ D(ALL_BRANCHES, "total branches",\