public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Renlin Li <renlin.li@arm.com>
To: Teresa Johnson <tejohnson@google.com>
Cc: Jeff Law <law@redhat.com>, Dehao Chen <dehao@google.com>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Ramana Radhakrishnan <Ramana.Radhakrishnan@arm.com>,
	 "su@cs.ucdavis.edu" <su@cs.ucdavis.edu>
Subject: Re: [PATCH]Partially fix PR61529, bound basic block frequency
Date: Thu, 06 Nov 2014 17:54:00 -0000	[thread overview]
Message-ID: <545BB5B5.90008@arm.com> (raw)
In-Reply-To: <CAAe5K+XEY+trRiE4dpNjr7-o=Bnky_OAX8w2+Qwaqv0jVbSLUw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

Hi Teresa,

Thank you for the suggestion, updated!

> Please add a comment that this is needed due to insane incoming frequencies.
>
> The 'b' variable is uninitialized. Also, 'd' and 'a' may end up
> uninitialized depending on the initial value of 'b'. Please initialize
> these.
>

Test case has been added. With the patch, both x86_64-unknown-linux-gnu 
and aarch64-none-elf compile the test case successfully.

x86_64-unknown-linux-gnu bootstrap and regression test have been done, 
no new issue.
aarch64-none-elf toolchain has been test on the model. No new regression.

gcc/ChangeLog:

2014-11-06  Renlin Li  <Renlin.Li@arm.com>
     PR middle-end/61529
     * tree-ssa-threadupdate.c (compute_path_counts): Bound path_in_freq.
      This is needed due to insane incoming frequencies.

gcc/testsuite/ChangeLog:

2014-11-06  Renlin Li  <Renlin.Li@arm.com>
     PR middle-end/61529
     * gcc.dg/pr61529.c: New.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch-1.diff --]
[-- Type: text/x-patch; name=patch-1.diff, Size: 1229 bytes --]

commit b38cf02619f03be9d200849734f4454502d1e5ac
Author: Renlin Li <renlin.li@arm.com>
Date:   Tue Oct 28 16:30:42 2014 +0000

    fix pr61529

diff --git a/gcc/testsuite/gcc.dg/pr61529.c b/gcc/testsuite/gcc.dg/pr61529.c
new file mode 100644
index 0000000..392239e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr61529.c
@@ -0,0 +1,27 @@
+/* PR middle-end/61529 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+unsigned int a = 0, b = 0;
+unsigned int c;
+
+int
+main ()
+{
+  unsigned int d = 0;
+  int e[5];
+
+  for (; b < 1; b++)
+    d = 0;
+  for (; d < 1; d++)
+    a = 0;
+  for (; a < 1; a++)
+    ;
+
+  for (c = 0; c < 5; c++)
+    e[c] = 1;
+  if (e[0])
+    c = 0;
+
+  return 0;
+}
diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c
index d2cf4de..e3077a1 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -730,6 +730,10 @@ compute_path_counts (struct redirection_data *rd,
             nonpath_count += ein->count;
         }
     }
+
+  if (path_in_freq > BB_FREQ_MAX)
+    path_in_freq = BB_FREQ_MAX;
+
   BITMAP_FREE (in_edge_srcs);
 
   /* Now compute the fraction of the total count coming into the first

  reply	other threads:[~2014-11-06 17:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29  9:35 Renlin Li
2014-10-29 12:55 ` Teresa Johnson
2014-11-03 15:29   ` Renlin Li
2014-11-04 21:59     ` Jeff Law
2014-11-06 15:09       ` Renlin Li
2014-11-06 15:38         ` Teresa Johnson
2014-11-06 17:54           ` Renlin Li [this message]
2014-11-06 17:59             ` Teresa Johnson
2014-11-06 18:07               ` Renlin Li
2014-11-10 17:00                 ` [PING][PATCH]Partially " Renlin Li
2014-11-10 17:10                   ` Teresa Johnson
2014-11-11 21:43                   ` Jeff Law

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=545BB5B5.90008@arm.com \
    --to=renlin.li@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=dehao@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=su@cs.ucdavis.edu \
    --cc=tejohnson@google.com \
    /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).