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]

[patch] Bunch of ivopts improvements patches


Hello,

while trying to make ivopts produce decent code on ppc64, I made several
patches.  Most of them are obviously unsuitable for stage 3, but for
completeness I am sending all of them.  All the patches below were
bootstrapped and regtested on at least one of i686, ppc and ia64
separately, and on x86_64 and ppc64 all together.  All together the
patches bring significant improvements in spec score on ppc64,
making both -fivopts better than -fno-ivopts (which is not the case
currently).

The patches and corresponding changelogs are attached:

1) Adds cfgcleanup between loop optimizer passes.  A slightly different
   version is already in tcb, so this definitely is not suitable for
   merging.

2) Rewrites and improves analysis of whether induction variable
   overflows.  In addition to using fold as previously:
   
   -- it also contains a solver for linear inequalities in modulo
      arithmetics (not a complete one, since this seems to be quite
      complicated problem, but one that should work in the most common cases).
   -- it directly checks the conditions in the program, instead of
      relying on those recorded in 'additional' field of the bounds
      record.

3) Makes fold ignore differences in signedness of operands when folding
   X - X type expression to 0 (e.g. ((int) X + 3) - ((unsigned) X + 3) = 0).

4) Some optimizations (ivopts, pre) produce a bit messy code and expect
   further passes (dce, dom) to clean it up.  This however makes dumps
   harder to read.  This patch makes it possible to show dumps like if
   trivially dead code was removed and expressions were propagated
   through assignments to temporary variables.

5) Adds dominator and dce pass after pre to clean up the code before
   loop optimization.

   Curiously, although this patch is obviously harmless, it is the only
   one to cause regressions in testsuite:

   gcc.dg/tree-ssa/ifc-20040816-1.c (test for excess errors)
   gcc.dg/tree-ssa/ifc-20040816-2.c (test for excess errors)
   gcc.dg/tree-ssa/ltrans-1.c (test for excess errors)
   gcc.dg/tree-ssa/ltrans-1.c scan-tree-dump-times transformed loop 1

   The if-conversion problems are now PR 19067, I haven't investigated
   the ltrans problems yet.

6) Makes loops for that complete unrolling does not increase code size
   to be always unrolled.

7) Makes strip_offset to also strip constant offsets from inside
   addresses (&a[4].x == &a[0].x + offset), and use it in
   add_address_candidates (so that we try to express iv use of type
   a[i][0] = ..., a[i][1] = ..., a[i][2] = ... using a single iv
   with base &a[i][0]).

8) The patch to fix PR 18219 (previously posted in
   http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00025.html)

9) Makes the mode of the memory reference to be taken into account when
   determining cost of the address.

10) When the original signed induction variable is preserved, we still
    rewrite the increment to i = (int) ((unsigned) i + 1).  This is of
    course stupid and confuses other optimizers.  This patch avoids
    emitting these unnecessary casts.

Zdenek

Attachment: chl_hppc1
Description: Text document

Attachment: diff_hppc1.diff
Description: Text document

Attachment: chl_hppc2
Description: Text document

Attachment: diff_hppc2.diff
Description: Text document

Attachment: diff_hppc3.diff
Description: Text document

Attachment: diff_hppc4.diff
Description: Text document

Attachment: diff_hppc5.diff
Description: Text document

Attachment: diff_hppc6.diff
Description: Text document

Attachment: diff_hppc7.diff
Description: Text document

Attachment: diff_hppc8.diff
Description: Text document

Attachment: diff_hppc9.diff
Description: Text document

Attachment: diff_hppc10.diff
Description: Text document

Attachment: chl_hppc3
Description: Text document

Attachment: chl_hppc4
Description: Text document

Attachment: chl_hppc5
Description: Text document

Attachment: chl_hppc6
Description: Text document

Attachment: chl_hppc7
Description: Text document

Attachment: chl_hppc8
Description: Text document

Attachment: chl_hppc9
Description: Text document

Attachment: chl_hppc10
Description: Text document


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