This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Speedup RTL PRE

Another stand-alone compile-time performance improvement found while
working on an unrelated change set.

The RTL PRE code is being rather silly in its management of the
available and anticipatable occurrence lists.

For any expression, we have a list of occurrences of those expressions
which are built during a scan of the RTL.  We guarantee that we only
record one instance of a given expression per block in our list --
either the first or the last within a block, depending on which list
we care about.

The code to make sure that only one occurrence per block is recorded
for a given expression walks the *entire* list of occurrences for the

Normally any particular expression will show up in a small number of
blocks and this walk is pretty cheap.

However, in machine generated code such as we find in insn-attrtab
(and possibly other insn-foo things) we can have the same expression
in a large number of blocks (look at how we use which_alternative as
an example).  At which point the walks down those lists start to become
measurable from a compile-time standpoint.

Fixing the occurrence list management code to always insert at the head
of the list avoids the list walking *AND* makes the code simpler.  I
like that :-)  [ The rest of the code doesn't care about ordering of
those lists. ]

For insn-attrtab.i we get a nice 2.8% improvement in compile time.  For
the components of cc1 we get a .5% improvement.

Bootstrapped and regression tested on i686-pc-linux-gnu.  For added
measure I also verified that the resulting assembly code for the
components of cc1 was unchanged after applying this patch.

Attachment: PPP
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]