public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Make df_ref representation more efficient
@ 2014-06-14 19:36 Richard Sandiford
  2014-06-14 19:43 ` [PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES} Richard Sandiford
                   ` (5 more replies)
  0 siblings, 6 replies; 28+ messages in thread
From: Richard Sandiford @ 2014-06-14 19:36 UTC (permalink / raw)
  To: gcc-patches

Walks of things like DF_REF_INSN_USES were showing up high in the profile
of a fold-const.ii compilation.  These reference lists are represented
as pointers to null-terminated lists of pointers, and since there's
little locality when walking all insns, each loop over the uses or defs
generally has two major cache misses before it can do anything
(or one major cache miss before doing nothing), on top of accessing
the underlying df_insn_info.  Also, for -O0, the overhead of mallocing
lots of small arrays is itself noticeable.

I don't think there's any real need for this representation.  Each
df_ref belongs to exactly one of these null-terminated pointer arrays,
so using a normal linked list would be more efficient memory-wise
(because we'd save on the null terminator and separate malloced memory).

The idea might have been to allow the array to be sorted easily.
That doesn't really apply now though.  We collect the references in a
df_collection_rec and sort them there before populating the df_insn_info.
After that we just insert single elements or merge two sorted lists.
(Both of these are currently done as full qsorts, but don't need to be.)

Using a linked list gives a consistent 2% compile-time improvement for
fold-const.ii -O0 and ~1% for various -O2 compiles I tried.  The df
routines do still show up high on the profile though.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard

^ permalink raw reply	[flat|nested] 28+ messages in thread
* Re: breakage with "[PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES}"
@ 2014-06-16  1:37 David Edelsohn
  0 siblings, 0 replies; 28+ messages in thread
From: David Edelsohn @ 2014-06-16  1:37 UTC (permalink / raw)
  To: Steven Bosscher, Richard Sandiford; +Cc: Hans-Peter Nilsson, GCC Patches

The auto-inc-dec.c compilation fix gets us to the next error -- a
runtime failure in the file:


(gdb) run -g -O2 -mlong-double-128 -fbuilding-libgcc
-fno-stack-protector __gcc_bcmp.i
Starting program: /tmp/20140615/gcc/cc1 -g -O2 -mlong-double-128
-fbuilding-libgcc -fno-stack-protector __gcc_bcmp.i
 strtoimax select getdtablesize mode_size_inline mode_nunits_inline
mode_inner_inline __gcc_bcmp
Analyzing compilation unit
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups>
<*free_inline_summary> <whole-program> <profile_estimate> <devirt>
<cp> <cdtor> <inline> <pure-const> <static-var> <comdats>Assembling
functions:
 __gcc_bcmp
Program received signal SIGSEGV, Segmentation fault.
0x10276e4c in _ZL14merge_in_blockiP15basic_block_def (max_reg=174,
    bb=0x70001a00) at /nasfarm/edelsohn/src/src/gcc/auto-inc-dec.c:1427
1427                  reg_next_use[DF_REF_REGNO (def)] = NULL;

- David

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2014-06-16 11:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-14 19:36 [PATCH 0/6] Make df_ref representation more efficient Richard Sandiford
2014-06-14 19:43 ` [PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES} Richard Sandiford
2014-06-14 19:45   ` [PATCH 3/6] Add FOR_EACH_INSN_INFO_MW Richard Sandiford
2014-06-14 20:12     ` Steven Bosscher
2014-06-14 19:47   ` [PATCH 4/6] Add df_single_{def,use} helper functions Richard Sandiford
2014-06-14 20:15     ` Steven Bosscher
2014-06-14 20:10   ` [PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES} Steven Bosscher
2014-06-15 11:27   ` breakage with "[PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES}" Hans-Peter Nilsson
2014-06-15 16:21     ` Steven Bosscher
2014-06-15 22:37       ` Hans-Peter Nilsson
2014-06-15 22:53         ` Hans-Peter Nilsson
2014-06-15 23:39           ` Hans-Peter Nilsson
2014-06-16  8:04             ` Andreas Schwab
2014-06-16  8:29               ` Ramana Radhakrishnan
2014-06-16  8:30         ` Steven Bosscher
2014-06-16 11:23           ` Hans-Peter Nilsson
2014-06-16  7:59   ` [PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES} Andreas Schwab
2014-06-14 19:44 ` [PATCH 2/6] FOR_EACH_ARTIFICIAL_{DEF,USE} Richard Sandiford
2014-06-14 20:11   ` Steven Bosscher
2014-06-14 19:48 ` [PATCH 5/6] Remove dead code Richard Sandiford
2014-06-14 20:17   ` Steven Bosscher
2014-06-14 19:53 ` [PATCH 6/6] Use a linked list for insn defs and uses Richard Sandiford
2014-06-14 20:24   ` Steven Bosscher
2014-06-14 20:29 ` [PATCH 0/6] Make df_ref representation more efficient Steven Bosscher
2014-06-15  7:31   ` Richard Sandiford
2014-06-15 19:35 ` Jan Hubicka
2014-06-15 20:46   ` Jan Hubicka
2014-06-16  1:37 breakage with "[PATCH 1/6] Add FOR_EACH_INSN{_INFO}_{DEFS,USES,EQ_USES}" David Edelsohn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).