From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Jan Hubicka <jh@suse.cz>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] predict_loop fix (PR tree-optimization/48189)
Date: Wed, 09 Jan 2013 08:53:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.00.1301090951160.6889@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20130108200540.GO7269@tucnak.redhat.com>
On Tue, 8 Jan 2013, Jakub Jelinek wrote:
> Hi!
>
> This is Steven's patch from the PR plus mine hunk, bootstrapped/regtested on
> x86_64-linux and i686-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2013-01-08 Steven Bosscher <steven@gcc.gnu.org>
> Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/48189
> * predict.c (predict_loops): If max is 0, don't call compare_tree_int.
> If nitercst is 0, don't predict the exit edge.
>
> * gcc.dg/pr48189.c: New test.
>
> --- gcc/predict.c.jj 2013-01-04 13:44:35.000000000 +0100
> +++ gcc/predict.c 2013-01-08 15:58:15.552884491 +0100
> @@ -1434,7 +1434,8 @@ predict_loops (void)
> if (TREE_CODE (niter) == INTEGER_CST)
> {
> if (host_integerp (niter, 1)
> - && compare_tree_int (niter, max-1) == -1)
> + && max
> + && compare_tree_int (niter, max - 1) == -1)
> nitercst = tree_low_cst (niter, 1) + 1;
> else
> nitercst = max;
> @@ -1456,6 +1457,11 @@ predict_loops (void)
> else
> continue;
>
> + /* If the prediction for number of iterations is zero, do not
> + predict the exit edges. */
> + if (nitercst == 0)
> + continue;
> +
> probability = ((REG_BR_PROB_BASE + nitercst / 2) / nitercst);
> predict_edge (ex, predictor, probability);
> }
> --- gcc/testsuite/gcc.dg/pr48189.c.jj 2013-01-08 15:59:38.319433008 +0100
> +++ gcc/testsuite/gcc.dg/pr48189.c 2013-01-08 15:52:31.000000000 +0100
> @@ -0,0 +1,13 @@
> +/* PR tree-optimization/48189 */
> +/* { dg-do compile } */
> +/* { dg-options "-O --param max-predicted-iterations=0" } */
> +
> +struct S { int s[8]; };
> +
> +void
> +foo (int *x, struct S *y)
> +{
> + int i;
> + for (i = 0; y[i].s[i]; i++)
> + *x++ = y[i].s[i];
> +}
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend
prev parent reply other threads:[~2013-01-09 8:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-08 20:05 Jakub Jelinek
2013-01-09 8:53 ` Richard Biener [this message]
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=alpine.LNX.2.00.1301090951160.6889@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jh@suse.cz \
/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).