Adrian Prantl & Vedant Kumar, Apple October 2018
Debug Info for Optimized Code LLVM BoF Session Adrian Prantl & - - PowerPoint PPT Presentation
Debug Info for Optimized Code LLVM BoF Session Adrian Prantl & - - PowerPoint PPT Presentation
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
Ten years of LLVM Debug Info🎃
Ten years of debug info in LLVM
3000 6000 9000 12000 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 #commits to LLVM 125 250 375 500 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 #commits that modify test/DebugInfo
llvm-dwarfdump --statistics (2011–now)
0% 25% 50% 75% 100% 2011 (3.0) 2012 (3.2) 2014 (3.5) 2015 (3.6) 2016 (3.8) 2017 (4.0) 2018 (6.0)
%variables with location %regions covered
it’s complicated bigger = better
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)
Combine redundant instructions 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
# of missing locations # of missing debug values
E l i m i n a t i n g C
- d
e G e n d i f f e r e n c e s
- A
d d i t i
- n
a l c
- m
m u n i t y b
- t
s
- F
i n d i n g n e w b u g s Improving line table fidelity
- IRBuilder API
- Should Constructors take a DebugLoc?
- Testing (dexter?)
Backtrace quality
- Tail calls
- Merged functions
C
- d
e G e n P r e p a r e
- M
- v
i n g llvm.dbg.value GlobalISel
- Automatically preserving
debug info during combines D e b u g I n t r i n s i c s
- E
x t e n d i n g
llvm.dbg.value
- A
d
- p
t i n g
llvm.dbg.addr
SelectionDAG
- Audit all *Combiner rules
for debug info handling
Discussion flash cards
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