public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "steven at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/26944] [4.1/4.2 Regression] -ftree-ch generates worse code
Date: Tue, 02 May 2006 17:38:00 -0000	[thread overview]
Message-ID: <20060502173808.24979.qmail@sourceware.org> (raw)
In-Reply-To: <bug-26944-1008@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from steven at gcc dot gnu dot org  2006-05-02 17:38 -------
The inner loop in the .cunroll, .ivopts and .final_cleanup with GVN-PRE
disabled look like this:

  # Int_Index_37 = PHI <Int_Index_58(5), Int_Loc_3(3)>;
<L0>:;
  (*D.1561_56)[Int_Index_37] = Int_Loc_3;
  Int_Index_58 = Int_Index_37 + 1;
  if (D.1563_41 >= Int_Index_58) goto <L8>; else goto <L2>;

<L8>:;
  goto <bb 4> (<L0>);

and

  # ivtmp.34_26 = PHI <ivtmp.34_19(5), ivtmp.34_1(3)>;
  # Int_Index_37 = PHI <Int_Index_58(5), Int_Loc_3(3)>;
<L0>:;
  D.1613_59 = (int *) ivtmp.34_26;
  MEM[base: D.1613_59, offset: 20B] = Int_Loc_3;
  Int_Index_58 = Int_Index_37 + 1;
  ivtmp.34_19 = ivtmp.34_26 + 4B;
  if (D.1563_41 >= Int_Index_58) goto <L8>; else goto <L2>;

<L8>:;
  goto <bb 4> (<L0>);

and

<L0>:;
  MEM[base: (int *) ivtmp.34, offset: 20B] = Int_Loc;
  Int_Index = Int_Index + 1;
  ivtmp.34 = ivtmp.34 + 4B;
  if (D.1563 >= Int_Index) goto <L0>; else goto <L2>;

which compiles to:
.L4:
        addl    $1, %eax
        movl    %ecx, 20(%edx)
        addl    $4, %edx
        cmpl    %eax, %ebx
        jge     .L4



With PRE enabled, we get this:

  # Int_Index_37 = PHI <Int_Index_58(6), Int_Loc_3(4)>;
<L0>:;
  D.1559_54 = pretmp.27_59;
  D.1560_55 = pretmp.28_45;
  D.1561_56 = pretmp.28_49;
  (*pretmp.28_49)[Int_Index_37] = Int_Loc_3;
  Int_Index_58 = Int_Index_37 + 1;
  if (D.1563_41 >= Int_Index_58) goto <L8>; else goto <L9>;

<L8>:;
  goto <bb 5> (<L0>);

and

  # ivtmp.38_26 = PHI <ivtmp.38_35(6), 0(4)>;
<L0>:;
  D.1559_54 = pretmp.27_59;
  D.1560_55 = pretmp.28_45;
  D.1561_56 = pretmp.28_49;
  D.1622_34 = (int *) pretmp.28_49;
  D.1623_33 = (int *) Int_1_Par_Val_2;
  D.1624_22 = (int *) ivtmp.38_26;
  D.1625_21 = D.1623_33 + D.1624_22;
  MEM[base: D.1622_34, index: D.1625_21, step: 4B, offset: 20B] = Int_Loc_3;
  ivtmp.38_35 = ivtmp.38_26 + 1;
  D.1626_20 = (unsigned int) Int_1_Par_Val_2;
  D.1627_17 = D.1626_20 + ivtmp.38_35;
  D.1628_16 = D.1627_17 + 5;
  Int_Index_15 = (One_Fifty) D.1628_16;
  if (D.1563_41 >= Int_Index_15) goto <L8>; else goto <L9>;

<L8>:;
  goto <bb 5> (<L0>);

and

<L0>:;
  MEM[base: (int *) prephitmp.33, index: (int *) Int_1_Par_Val + (int *)
ivtmp.38, step: 4B, offset: 20B] = Int_Loc;
  ivtmp.38 = ivtmp.38 + 1;
  if ((One_Fifty) ((unsigned int) Int_1_Par_Val + 5 + ivtmp.38) <= D.1563) goto
<L0>; else goto <L2>;

and from there:
.L5:
        leal    (%edi,%edx), %eax
        addl    $1, %edx
        movl    %ecx, 20(%ebx,%eax,4)
        leal    (%ecx,%edx), %eax
        cmpl    %esi, %eax
        jle     .L5

So it's a mix of PRE and IVOPTs that gives this strange code.

BTW regarding "Its strange that tree-ch messes up", please next time don't
blame random passes if you don't fully analyze the problem.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26944


  parent reply	other threads:[~2006-05-02 17:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-30 16:15 [Bug tree-optimization/26944] New: " dann at godzilla dot ics dot uci dot edu
2006-03-30 16:25 ` [Bug tree-optimization/26944] [4.1/4.2 Regression] " rguenth at gcc dot gnu dot org
2006-03-30 16:43 ` dann at godzilla dot ics dot uci dot edu
2006-03-31 22:41   ` Daniel Berlin
2006-03-31 22:41 ` dberlin at dberlin dot org
2006-04-02  8:12 ` pinskia at gcc dot gnu dot org
2006-04-16 19:13 ` mmitchel at gcc dot gnu dot org
2006-05-02 17:38 ` steven at gcc dot gnu dot org [this message]
2006-05-03 18:55 ` dann at godzilla dot ics dot uci dot edu
2006-05-03 19:00   ` Andrew Pinski
2006-05-03 19:00 ` pinskia at physics dot uc dot edu
2006-05-03 21:33 ` steven at gcc dot gnu dot org
2006-05-03 21:53 ` dann at godzilla dot ics dot uci dot edu
2006-05-04 21:25 ` pinskia at gcc dot gnu dot org
2006-05-25  2:39 ` mmitchel at gcc dot gnu dot org
2007-02-14  9:10 ` [Bug tree-optimization/26944] [4.1/4.2/4.3 " mmitchel at gcc dot gnu dot org
2007-06-18  5:28 ` [Bug tree-optimization/26944] [4.1/4.2 " pinskia at gcc dot gnu dot org
2008-07-04 20:22 ` [Bug tree-optimization/26944] [4.2 " jsm28 at gcc dot gnu dot org
2009-03-30 15:51 ` jsm28 at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060502173808.24979.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).