[llvm] [PGO] Skip optimizing probes that don't fit. (PR #70875)

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 17:13:45 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;
----------------
dcci wrote:

Yes, updated to warn and break the computation in `computeProbeIdForCallsites`

https://github.com/llvm/llvm-project/pull/70875


More information about the llvm-commits mailing list