[llvm] [NFC] Move DroppedVariableStats to its own file and redesign it to be extensible. (PR #115563)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 12 01:23:33 PST 2024
================
@@ -132,64 +121,30 @@ void DroppedVariableStats::calculateDroppedVarStatsOnFunction(
PassDroppedVariables = false;
}
-void DroppedVariableStats::runAfterPassInvalidated(
- StringRef PassID, const PreservedAnalyses &PA) {
- DebugVariablesStack.pop_back();
- InlinedAts.pop_back();
+void DroppedVariableStatsIR::runOnModule(const Module *M, bool Before) {
+ for (auto &F : *M)
+ runOnFunction(&F, Before);
}
-void DroppedVariableStats::runAfterPass(StringRef PassID, Any IR,
- const PreservedAnalyses &PA) {
- std::string PassLevel;
- std::string FuncOrModName;
- if (auto *M = unwrapIR<Module>(IR)) {
- this->runOnModule(M, false);
- PassLevel = "Module";
- FuncOrModName = M->getName();
- calculateDroppedVarStatsOnModule(M, PassID, FuncOrModName, PassLevel);
- } else if (auto *F = unwrapIR<Function>(IR)) {
- this->runOnFunction(F, false);
- PassLevel = "Function";
- FuncOrModName = F->getName();
- calculateDroppedVarStatsOnFunction(F, PassID, FuncOrModName, PassLevel);
+void DroppedVariableStatsIR::calculateDroppedVarStatsOnModule(
+ const Module *M, StringRef PassID, std::string FuncOrModName,
+ std::string PassLevel) {
----------------
OCHyams wrote:
nit: I can see this is matching the previous interface but I don't think these need to be `std::string`s. Could be worth changing these to `StringRef`s while you're here? I'll leave that up to you.
(could come later/separately if you do change it)
https://github.com/llvm/llvm-project/pull/115563
More information about the llvm-commits
mailing list