Debug Info for Optimized Code LLVM BoF Session Adrian Prantl & Vedant Kumar, Apple October 2018
Ten years of LLVM Debug Info 🎃
Ten years of debug info in LLVM #commits to LLVM 12000 9000 6000 3000 0 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 #commits that modify test/DebugInfo 500 375 250 125 0 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018
llvm-dwarfdump --statistics (2011–now) %variables with location %regions covered 100% bigger = better 75% it’s complicated 50% 25% 0% 2011 (3.0) 2012 (3.2) 2014 (3.5) 2015 (3.6) 2016 (3.8) 2017 (4.0) 2018 (6.0) Input program: Clang 3.4 Configuration: (X86;Arm;AArch64), RelWithDebInfo (-O2)
Debug Info metrics collected in LNT http://lnt.llvm.org/ ⤳ clang-3.4-debuginfo-statistics
Which IR passes drop the most information? Debug Value/Location Loss (sqlite3 Amalgamation, opt -O2) # of missing locations Combine redundant instructions # of missing debug values Simplify the CFG Jump Threading Global Value Numbering Remove redundant instructions Early CSE w/ MemorySSA Value Propagation Bit-Tracking Dead Code Elimination Interprocedural Sparse Conditional Constant Propagation Dead Argument Elimination MemCpy Optimization MergedLoadStoreMotion SLP Vectorizer Reassociate expressions Dead Store Elimination Tail Call Elimination Sparse Conditional Constant Propagation Aggressive Dead Code Elimination 1 100 10000
Discussion flash cards GlobalISel • Automatically preserving C o d e G e n P debug info during combines r e p a r e • M o v i n g Backtrace quality llvm.dbg.value • Tail calls • Merged functions E l i m i n a t i n g C o d e G e n d i f f e r e n c e s • A d d i t i o n a l c o m m u n i t y b o t s • Improving line table fidelity F i n d i n g n e w b u g s • IRBuilder API • Should Constructors take a DebugLoc? • Testing (dexter?) SelectionDAG • Audit all *Combiner rules D e b u g I n t r i n s i c s for debug info handling • E x t e n d i n g llvm.dbg.value • A d o p t i n g llvm.dbg.addr
Resources LNT clang-3.4-debuginfo-statistics http://lnt.llvm.org/db_default/v4/nts/machine/1357 LLVM PR38768 [meta] Umbrella bug for poor debug experiences https://bugs.llvm.org/show_bug.cgi?id=38768 LLVM PR37953 [meta] fix -check-debugify failures https://bugs.llvm.org/show_bug.cgi?id=37953
Recommend
More recommend