[gdb] Speedup lnp_state_machine::handle_special_opcode
authorRichard Biener <rguenther@suse.de>
Fri, 14 Feb 2020 07:32:53 +0000 (08:32 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 14 Feb 2020 07:32:53 +0000 (08:32 +0100)
commit258bf0ee3748d4354e13daf00f02266cafa96389
treea6f6a7933d4d14869687dcf606e1f66fc1c23d97
parentd4059b1d6cb65296134ca9f3497249e84acb622e
[gdb] Speedup lnp_state_machine::handle_special_opcode

I see for some program at gdb startup:
...
Samples: 102K of event 'cycles:pu', Event count (approx.): 91710925103
Overhead  Command     Shared Object        Symbol
  15.21%  gdb         gdb                  [.]
lnp_state_machine::handle_special
...
where the divisions are the places we stall.  The following
micro-optimizes things but it smells like m_line_header->line_range
is constant, likewise probably m_line_header->maximum_ops_per_instruction
so eventually the divisions could be avoided completely with some
lookup table.

Well.  Micro-optimizing with this patch improves things
(don't expect [load] CSE over the gdbarch_adjust_dwarf2_line call).

Build and reg-tested on x86_64-linux.

gdb/ChangeLog:

2020-02-14  Richard Biener  <rguenther@suse.de>

* dwarf2/read.c (lnp_state_machine::handle_special_opcode): Apply CSE
on expression with division operators.
gdb/ChangeLog
gdb/dwarf2/read.c