This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [PR38711] Use DF_LIVE in IRA if it available (for -O2 and higher)


On 12-10-13 9:40 AM, Steven Bosscher wrote:
Hello,

This fixes the long-standing enhancement request to use DF_LIVE in
IRA. To quote the first comment in the PR:

IRA should be using the DF-LIVE sets, which are smaller than the DF-LR
sets when they are available (typically at O2 and above). The proper
sets can be conveniently accessed using the df_get_live_[in,out]
functions which use DF-LIVE if it is available and fall back to DF-LR
if it is not.

I thought that DF_LIVE wasn't available at -O1 in IRA, but
interestingly ira.c:ira() adds it to the DF-problems list in that case
already:

$ grep -C3 -n df_live_add ira.c
4160-
4161-  if (optimize == 1)
4162-    {
4163:      df_live_add_problem ();
4164-      df_live_set_all_dirty ();
4165-    }
4166-#ifdef ENABLE_CHECKING

So DF_LIVE is already being computed for IRA. It's just not being used
because the DF_LR_{IN,OUT} macros are used instead of the
df_get_live_{in,out} functions. With my patch, the DF_LIVE sets are
used, which results in marginally faster compile times for my set of
cc1-i files on power64 and on x86_64, as well as smaller code. There's
also a good speedup for the PR54146 test case.

Only reload.c still uses the DF_LR_OUT. The comment in
find_dummy_reload() suggests this is intentional.

I also fond a bug in IRA:

4392-     touch the artificial uses and defs.  */
4393-  df_finish_pass (true);
4394-  if (optimize > 1)
4395:    df_live_add_problem ();
4396-  df_scan_alloc (NULL);
4397-  df_scan_blocks ();
4398-

At optimize>1 the DF_LIVE problem is already always computed. I think
the idea here was to *remove* the DF_LIVE problem at -O1, which is
also part of the attached patch.
(Perhaps we should even simply not add the DF_LIVE problem at -O1, but
that can be done in a follow-up patch if necessary.)

Bootstrapped and tested (with default checking and with release
checking) on powerpc64-unknown-linux-gnu and x86_64-unknown-linux-gnu.
OK for trunk?


LIVE is not used on purpose. I added LIVE usage to the old RA about 10 years ago (it was before DF-infrastructure). Everything was ok until, somebody reported compiler crash on semantically wrong program (something with usage of uninitialized variable). After that I removed this code.

Probably, that is also a reason why reload uses LR not LIVE. So I'd like to wait a few weeks. When I have more time, I am going to reproduce this test suite and look how IRA behaves on it.

Thanks, Steven.


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