21 auto FuncName =
F->getName();
26void DroppedVariableStatsIR::calculateDroppedVarStatsOnFunction(
36void DroppedVariableStatsIR::runOnModule(
StringRef PassID,
const Module *M,
39 runOnFunction(PassID, &
F,
Before);
43void DroppedVariableStatsIR::calculateDroppedVarStatsOnModule(
47 calculateDroppedVarStatsOnFunction(&
F, PassID, FuncOrModName, PassLevel);
66void DroppedVariableStatsIR::visitEveryInstruction(
69 const DIScope *DbgValScope = std::get<0>(Var);
71 auto *DbgLoc =
I.getDebugLoc().get();
75 InlinedAtsMap, Var, DroppedCount))
80void DroppedVariableStatsIR::visitEveryDebugRecord(
86 if (
auto *Dbg = dyn_cast<DbgVariableRecord>(&DR)) {
87 auto *DbgVar =
Dbg->getVariable();
88 auto DbgLoc = DR.getDebugLoc();
Expand Atomic instructions
===- DroppedVariableStatsIR.h - Opt Diagnostics -*- C++ -*-----------—===//
Legalize the Machine IR a function s Machine IR
PassInstrumentationCallbacks PIC
Base class for scope-like contexts.
Base class for non-instruction debug metadata records that have positions within IR.
Implements a dense probed hash-table based set.
void runBeforePass(StringRef P, Any IR)
void registerCallbacks(PassInstrumentationCallbacks &PIC)
void runAfterPass(StringRef P, Any IR)
void calculateDroppedStatsAndPrint(DebugVariables &DbgVariables, StringRef FuncName, StringRef PassID, StringRef FuncOrModName, StringRef PassLevel, const Function *Func)
Calculate the number of dropped variables in an llvm::Function or llvm::MachineFunction and print the...
void populateVarIDSetAndInlinedMap(const DILocalVariable *DbgVar, DebugLoc DbgLoc, DenseSet< VarID > &VarIDSet, DenseMap< StringRef, DenseMap< VarID, DILocation * > > &InlinedAtsMap, StringRef FuncName, bool Before)
Populate the VarIDSet and InlinedAtMap with the relevant information needed for before and after pass...
bool DroppedVariableStatsEnabled
bool updateDroppedCount(DILocation *DbgLoc, const DIScope *Scope, const DIScope *DbgValScope, DenseMap< VarID, DILocation * > &InlinedAtsMap, VarID Var, unsigned &DroppedCount)
Check if a Var has been dropped or is a false positive.
void run(DebugVariables &DbgVariables, StringRef FuncName, bool Before)
Run code to populate relevant data structures over an llvm::Function or llvm::MachineFunction.
SmallVector< DenseMap< const Function *, DebugVariables > > DebugVariablesStack
A stack of a DenseMap, that maps DebugVariables for every pass to an llvm::Function.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
std::tuple< const DIScope *, const DIScope *, const DILocalVariable * > VarID
A unique key that represents a debug variable.
This class manages callbacks registration, as well as provides a way for PassInstrumentation to pass ...
void registerAfterPassInvalidatedCallback(CallableT C, bool ToFront=false)
void registerBeforeNonSkippedPassCallback(CallableT C)
void registerAfterPassCallback(CallableT C, bool ToFront=false)