public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jingyu at google dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/42720] Problematic condition simplification logic at unswitch-loops pass
Date: Fri, 29 Jan 2010 23:59:00 -0000	[thread overview]
Message-ID: <20100129235936.2198.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42720-17567@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from jingyu at google dot com  2010-01-29 23:59 -------
You must set "--param max-unswitch-level=0" to trigger the bug in non-FDO use.

I just tried gcc-4.2.4 on X86 platform. The problem exists.

$ gcc loop.cpp -O3  --param max-unswitch-level=0 -m32 -S
        testl   %eax, %eax
        jne     .L5
        xorl    %eax, %eax
        .p2align 4,,7
.L7:
        addl    $1, %eax      <--- empty loop
        cmpl    %edx, %eax
        jne     .L7
        xorl    %ecx, %ecx

By default, max-unswitch-level is 3. So if you don't change max-unswitch-level,
after unswitch loop once, the conditions of nloop and loop can be simplified by
recursive calls.

Rather than writing a complicated test case which will do unswitch-loop 4
times, I would like to change the max-unswitch-level=0 to trigger the bug
early.

In FDO use, you can reproduce the bug with "-O2 -fprofile-use" on x86 with
gcc-4.4.0 or higher. I have checked gcc-4.2.x. The check "if
optimize_loop_for_size_p(loop)" is not in gcc-4.2.x. So gcc-4.2.x does not have
this problem in FDO use.


-- 


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


  parent reply	other threads:[~2010-01-29 23:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13  2:47 [Bug tree-optimization/42720] New: Empty loop generated at unswitch-loops with -O2 -fprofile-use jingyu at google dot com
2010-01-29 23:34 ` [Bug tree-optimization/42720] Problematic condition simplification logic at unswitch-loops pass jingyu at google dot com
2010-01-29 23:38 ` pinskia at gcc dot gnu dot org
2010-01-29 23:59 ` jingyu at google dot com [this message]
2010-01-30  0:05 ` pinskia at gcc dot gnu dot org
2010-01-30  0:21 ` jingyu at google dot com
2010-01-30 10:59 ` rguenth at gcc dot gnu dot org
2010-01-30 11:00 ` rguenth at gcc dot gnu dot org
2010-01-30 12:01 ` rakdver at gcc dot gnu dot org
2010-01-30 16:07 ` rguenth at gcc dot gnu dot org
2010-01-30 16:14 ` steven at gcc dot gnu dot org
2010-01-30 23:33 ` jingyu at google dot com
2010-02-02 23:57 ` jingyu at google dot com
2010-02-07 20:28 ` pinskia at gcc dot gnu dot org
2010-04-08 18:17 ` jingyu at gcc dot gnu dot org
2010-05-13 18:09 ` jingyu at google dot com

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=20100129235936.2198.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).