Skip to content

Commit eef0427

Browse files
authored
Merge pull request #70286 from kubamracek/embedded-diag-loc
[embedded] When missing a source location in a PerformanceDiagnostic, at least print the function name
2 parents d699226 + ea47c81 commit eef0427

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/SILOptimizer/Mandatory/PerformanceDiagnostics.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ bool PerformanceDiagnostics::visitFunction(SILFunction *function,
181181

182182
for (SILInstruction &inst : block) {
183183
if (visitInst(&inst, perfConstr, parentLoc)) {
184+
if (inst.getLoc().getSourceLoc().isInvalid()) {
185+
auto demangledName = Demangle::demangleSymbolAsString(
186+
inst.getFunction()->getName(),
187+
Demangle::DemangleOptions::SimplifiedUIDemangleOptions());
188+
llvm::errs() << "in function " << demangledName << "\n";
189+
}
184190
LLVM_DEBUG(llvm::dbgs() << inst << *inst.getFunction());
185191
return true;
186192
}
@@ -582,6 +588,12 @@ void PerformanceDiagnostics::checkNonAnnotatedFunction(SILFunction *function) {
582588
if (function->getModule().getOptions().EmbeddedSwift) {
583589
auto loc = LocWithParent(inst.getLoc().getSourceLoc(), nullptr);
584590
if (visitInst(&inst, PerformanceConstraints::None, &loc)) {
591+
if (inst.getLoc().getSourceLoc().isInvalid()) {
592+
auto demangledName = Demangle::demangleSymbolAsString(
593+
inst.getFunction()->getName(),
594+
Demangle::DemangleOptions::SimplifiedUIDemangleOptions());
595+
llvm::errs() << "in function " << demangledName << "\n";
596+
}
585597
LLVM_DEBUG(llvm::dbgs() << inst << *inst.getFunction());
586598
}
587599
}

0 commit comments

Comments
 (0)