[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:22:02 PDT 2023
================
@@ -221,12 +222,26 @@ void SampleProfileProber::computeProbeIdForBlocks() {
}
void SampleProfileProber::computeProbeIdForCallsites() {
+ LLVMContext &Ctx = F->getContext();
+ Module *M = F->getParent();
+
for (auto &BB : *F) {
for (auto &I : BB) {
if (!isa<CallBase>(I))
continue;
if (isa<IntrinsicInst>(&I))
continue;
+
+ // 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 (LastProbeId >= 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:
This doesn't break the outer loop. Maybe just return?
https://github.com/llvm/llvm-project/pull/70875
More information about the llvm-commits
mailing list