[llvm] [PGO] Skip optimizing probes that don't fit. (PR #70875)
Hongtao Yu via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 17:03:48 PDT 2023
================
@@ -324,6 +326,17 @@ void SampleProfileProber::instrumentOneFunc(Function &F, TargetMachine *TM) {
for (auto &I : CallProbeIds) {
auto *Call = I.first;
uint32_t Index = I.second;
+
+ // There's a limit on the number of probe indices that can be optimized.
+ // The current implementation uses the lower 16 bits of the discriminator
+ // so anything larger than 0xFFFF will be ignored.
+ if (Index > 0xFFFF) {
+ std::string Msg = "Pseudo instrumentation incomplete for " +
+ std::string(F.getName()) + " because it's too large";
+ Ctx.diagnose(DiagnosticInfoSampleProfile(M->getName().data(), Msg));
+ break;
----------------
htyu wrote:
Since this is not processing in ID order, we should still be able to instrument for the rest callsites. Can we move the warning code out of the `for` loop?
https://github.com/llvm/llvm-project/pull/70875
More information about the llvm-commits
mailing list