Debug Info for Optimized Code LLVM BoF Session Adrian Prantl & - - PowerPoint PPT Presentation

debug info for optimized code llvm bof session
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Adrian Prantl & Vedant Kumar, Apple October 2018

Debug Info for Optimized Code LLVM BoF Session

slide-2
SLIDE 2

Ten years of LLVM Debug Info🎃

slide-3
SLIDE 3

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

slide-4
SLIDE 4

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)

slide-5
SLIDE 5

Debug Info metrics collected in LNT http://lnt.llvm.org/ ⤳ clang-3.4-debuginfo-statistics

slide-6
SLIDE 6

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

slide-7
SLIDE 7

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

slide-8
SLIDE 8

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

Resources