https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/109184
>From f654c77a3f1902b8dc7d9674d89f08f7fca0c85f Mon Sep 17 00:00:00 2001 From: Mircea Trofin <mtro...@google.com> Date: Tue, 17 Sep 2024 22:03:30 -0700 Subject: [PATCH] [ctx_prof] Don't try finding callsite annotation for un-instrumentable callsites --- llvm/lib/Analysis/CtxProfAnalysis.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Analysis/CtxProfAnalysis.cpp b/llvm/lib/Analysis/CtxProfAnalysis.cpp index c29709b613410e..3df72983862d98 100644 --- a/llvm/lib/Analysis/CtxProfAnalysis.cpp +++ b/llvm/lib/Analysis/CtxProfAnalysis.cpp @@ -234,16 +234,23 @@ PreservedAnalyses CtxProfAnalysisPrinterPass::run(Module &M, } InstrProfCallsite *CtxProfAnalysis::getCallsiteInstrumentation(CallBase &CB) { - for (auto *Prev = CB.getPrevNode(); Prev; Prev = Prev->getPrevNode()) + if (!InstrProfCallsite::canInstrumentCallsite(CB)) + return nullptr; + for (auto *Prev = CB.getPrevNode(); Prev; Prev = Prev->getPrevNode()) { if (auto *IPC = dyn_cast<InstrProfCallsite>(Prev)) return IPC; + assert(!isa<CallBase>(Prev) && + "didn't expect to find another call, that's not the callsite " + "instrumentation, before an instrumentable callsite"); + } return nullptr; } InstrProfIncrementInst *CtxProfAnalysis::getBBInstrumentation(BasicBlock &BB) { for (auto &I : BB) if (auto *Incr = dyn_cast<InstrProfIncrementInst>(&I)) - return Incr; + if (!isa<InstrProfIncrementInstStep>(&I)) + return Incr; return nullptr; } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits