[llvm] [NFC] Move DroppedVariableStats to its own file and redesign it to be extensible. (PR #115563)
Adrian Prantl via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 13:02:44 PST 2024
================
@@ -70,36 +83,131 @@ class DroppedVariableStats {
/// DenseMap of VarIDs and their inlinedAt locations before an optimization
/// pass has run.
SmallVector<DenseMap<StringRef, DenseMap<VarID, DILocation *>>> InlinedAts;
+ /// Remove a dropped #dbg_value VarID from all Sets in the
+ /// DroppedVariablesBefore stack.
+ void removeVarFromAllSets(VarID Var, const Function *F) {
+ // Do not remove Var from the last element, it will be popped from the
+ // stack.
+ for (auto &DebugVariablesMap : llvm::drop_end(DebugVariablesStack))
+ DebugVariablesMap[F].DebugVariablesBefore.erase(Var);
+ }
+ /// Return true if \p Scope is the same as \p DbgValScope or a child scope of
+ /// \p DbgValScope, return false otherwise.
+ bool isScopeChildOfOrEqualTo(const DIScope *Scope,
+ const DIScope *DbgValScope);
+ /// Return true if \p InlinedAt is the same as \p DbgValInlinedAt or part of
+ /// the InlinedAt chain, return false otherwise.
+ bool isInlinedAtChildOfOrEqualTo(const DILocation *InlinedAt,
+ const DILocation *DbgValInlinedAt);
- /// Iterate over all Functions in a Module and report any dropped debug
- /// information. Will call calculateDroppedVarStatsOnFunction on every
- /// Function.
- void calculateDroppedVarStatsOnModule(const Module *M, StringRef PassID,
- std::string FuncOrModName,
- std::string PassLevel);
- /// Iterate over all Instructions in a Function and report any dropped debug
- /// information.
- void calculateDroppedVarStatsOnFunction(const Function *F, StringRef PassID,
- std::string FuncOrModName,
- std::string PassLevel);
+ /// Calculate the number of dropped variables in an llvm::Function or
+ /// llvm::MachineFunction and print the relevant information to stdout.
+ void calculateDroppedStatsAndPrint(DebugVariables &DbgVariables,
+ StringRef FuncName, StringRef PassID,
+ StringRef FuncOrModName,
+ StringRef PassLevel);
+
+ /// Check if a \p Var has been dropped or is a false positive.
+ bool checkDroppedStatus(DILocation *DbgLoc, const DIScope *Scope,
----------------
adrian-prantl wrote:
wasDropped()?
https://github.com/llvm/llvm-project/pull/115563
More information about the llvm-commits
mailing list