17 #define LOC_DEBUG(X) DEBUG_WITH_TYPE(DebugType.str().c_str(), X)
19 void LostDebugLocObserver::analyzeDebugLocations() {
20 if (LostDebugLocs.empty()) {
24 if (PotentialMIsForDebugLocs.empty()) {
26 dbgs() <<
".. No instructions to carry debug info (dead code?)\n");
30 LOC_DEBUG(
dbgs() <<
".. Searching " << PotentialMIsForDebugLocs.size()
31 <<
" instrs for " << LostDebugLocs.size() <<
" locations\n");
34 if (!
MI->getDebugLoc())
38 if (
MI->getDebugLoc().getLine() == 0) {
40 dbgs() <<
".. Assuming line-0 location covers remainder (if any)\n");
43 if (LostDebugLocs.erase(
MI->getDebugLoc())) {
49 if (LostDebugLocs.empty())
52 NumLostDebugLocs += LostDebugLocs.size();
54 dbgs() <<
".. Lost locations:\n";
55 for (
const DebugLoc &Loc : LostDebugLocs) {
60 dbgs() <<
".. MIs with matched locations:\n";
62 if (PotentialMIsForDebugLocs.erase(
MI))
64 dbgs() <<
".. Remaining MIs with unmatched/no locations:\n";
72 analyzeDebugLocations();
73 PotentialMIsForDebugLocs.clear();
74 LostDebugLocs.clear();
78 PotentialMIsForDebugLocs.insert(&
MI);
85 case TargetOpcode::G_CONSTANT:
86 case TargetOpcode::G_FCONSTANT:
87 case TargetOpcode::G_IMPLICIT_DEF:
88 case TargetOpcode::G_GLOBAL_VALUE:
97 PotentialMIsForDebugLocs.erase(&
MI);
99 LostDebugLocs.insert(
MI.getDebugLoc());
106 PotentialMIsForDebugLocs.erase(&
MI);
107 if (
MI.getDebugLoc())
108 LostDebugLocs.insert(
MI.getDebugLoc());
112 PotentialMIsForDebugLocs.insert(&
MI);