There will always be instructions with no line information attached.
One example is the LocalArea constants generated by FastISel, but it's
by far not the only one. Compiler generated code will have no line info
and might get inlined. SelectionDAG is full of nodes that won't have
any line information (because they could be shared).
Multiple attempts have been made over time to fix the FastISel issue,
but none have felt satisfactory enough to be commited. As the prolem
is much more general than just FastISel, this patch addresses it
at line table emission time rather than instruction selection time.
It also doesn't try to give accurate line information for these
instructions, but rather marks them with a 0 line information so that
the debugger can safely ignore them.
The implemented heuristic will add a line 0 information to every insn
missing a line information and either:
- at the beginning of a basic-block
- after a call
- first instruction after a label
The first 2 conditions handle the FastISel case, while the later enforces
that any instruction referenced by anything (including debug info) has
line information.
The initial measurments on line table size show an impact between 5% and 15%
(the latter is for a control-flow heavy code eg. ASANified).
There was already an option to use line 0 information for all the instructions
with no debug locations. The commit history for this code show that it was
disabled because it caused issues with GDB and with the line table size. Note
that this code was unconditionaly emitting those line 0 informations and not
using a heuristic to find intersting instructions like this one.
Maybe PrevBB and PrevWasCall, for consistency?