[PATCH] Refactor debug info lexical block generation

Paul Robinson Paul_Robinson at playstation.sony.com
Wed May 27 09:30:15 PDT 2015


Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:545-549
@@ +544,7 @@
+    bool Skip = Die->getAbbrev().getTag() == dwarf::DW_TAG_lexical_block;
+    for (auto &Child : Die->getChildren()) {
+      Dies.push_back(&*Child);
+      Skip &= (Child->getAbbrev().getTag() == dwarf::DW_TAG_lexical_block ||
+               Child->getAbbrev().getTag() == dwarf::DW_TAG_inlined_subroutine);
+    }
friss wrote:
> probinson wrote:
> > friss wrote:
> > > This seems prohibitively expensive, you are adding each and every DIE in the tree to the worklist. I'm pretty sure you could filter to only take subprograms/blocks/inline_subroutines. (Even better, don't we already collect all the functions somewhere?)
> > > 
> > > This also seems wrong. You might remove inlined_subroutines with that change and we don't want that.
> > I don't think this will remove inlined_subroutine DIEs; the intent here is that if a lexical_block contains (only) an inlined_subroutine, it's okay to eliminate the lexical_block, because the inlined_subroutine is its own scope.
> Doh, you're right. Skip is set only if the current DIE is a lexical block. Still the way this is done seems very expensive. I bet the cost of that walk in noticeable in a RelWithDebugInfo build. Can we get some numbers?
Maybe DwarfCompileUnit should keep track of the lexical blocks as they get created?  then you can just run that list here.



More information about the llvm-commits mailing list