[llvm-branch-commits] [llvm] [nfc][ctx_prof] Don't try finding callsite annotation for un-instrumentable callsites (PR #109184)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 18 12:59:33 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Mircea Trofin (mtrofin)
<details>
<summary>Changes</summary>
Reinforcing properties ensured at instrumentation time.
---
Full diff: https://github.com/llvm/llvm-project/pull/109184.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/CtxProfAnalysis.cpp (+9-2)
``````````diff
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;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/109184
More information about the llvm-branch-commits
mailing list