Skip to content

Instantly share code, notes, and snippets.

@artempyanykh
Created February 27, 2025 23:39
// Copy DIFinder from cache which is primed on F's compile unit when available
auto *PrimedDIFinder = cachedDIFinder(F, DICache);
- if (PrimedDIFinder)
+ if (PrimedDIFinder) {
+ TimeTraceScope FunctionScope("DICacheCheck");
DIFinder = *PrimedDIFinder;
+ DebugInfoFinder Baseline;
+ Baseline.processCompileUnit(F.getSubprogram()->getUnit());
+ {
+ TimeTraceScope FunctionScope("DICacheCheckAsserts");
+ if (!llvm::equal(DIFinder.compile_units(), Baseline.compile_units())) {
+ llvm::errs() << "DIFinder cache compile units mismatch for "
+ << F.getName() << "\n";
+ exit(42);
+ }
+ if (!llvm::equal(DIFinder.types(), Baseline.types())) {
+ llvm::errs() << "DIFinder cache types mismatch for " << F.getName()
+ << "\n";
+ exit(43);
+ }
+ if (!llvm::equal(DIFinder.subprograms(), Baseline.subprograms())) {
+ llvm::errs() << "DIFinder cache subprograms mismatch for "
+ << F.getName() << "\n";
+ exit(44);
+ }
+ if (!llvm::equal(DIFinder.scopes(), Baseline.scopes())) {
+ llvm::errs() << "DIFinder cache scopes mismatch for " << F.getName()
+ << "\n";
+ exit(45);
+ }
+ }
+ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment