diff mbox

Partially fix PR61529, bound basic block frequency

Message ID 545BB8F5.8070500@arm.com
State New
Headers show

Commit Message

Renlin Li Nov. 6, 2014, 6:07 p.m. UTC
On 06/11/14 17:59, Teresa Johnson wrote:
> Thanks for fixing the test case. Can you also add the comment I
> suggested to the source change?
>
>> Please add a comment that this is needed due to insane incoming frequencies.
>>

Sorry, I mistakenly add it to the ChangeLog. Should be correct now.


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.

gcc/testsuite/ChangeLog:

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

Comments

Renlin Li Nov. 10, 2014, 4:59 p.m. UTC | #1
On 06/11/14 18:07, Renlin Li wrote:
> On 06/11/14 17:59, Teresa Johnson wrote:
>> Thanks for fixing the test case. Can you also add the comment I
>> suggested to the source change?
>>
>>> Please add a comment that this is needed due to insane incoming 
>>> frequencies.
>>>
>
> Sorry, I mistakenly add it to the ChangeLog. Should be correct now.
>
>
> 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.
>
> gcc/testsuite/ChangeLog:
>
> 2014-11-06  Renlin Li <Renlin.Li@arm.com>
>     PR middle-end/61529
>     * gcc.dg/pr61529.c: New.

Hi,

Can anybody help to review or approve this?

Kind regards,
Renlin Li
Teresa Johnson Nov. 10, 2014, 5 p.m. UTC | #2
Hi Renlin,

Looks like Jeff already approved it:

>Can you add a testcase please?  With a testcase, this patch is OK for the trunk.

Teresa

On Mon, Nov 10, 2014 at 8:59 AM, Renlin Li <renlin.li@arm.com> wrote:
> On 06/11/14 18:07, Renlin Li wrote:
>>
>> On 06/11/14 17:59, Teresa Johnson wrote:
>>>
>>> Thanks for fixing the test case. Can you also add the comment I
>>> suggested to the source change?
>>>
>>>> Please add a comment that this is needed due to insane incoming
>>>> frequencies.
>>>>
>>
>> Sorry, I mistakenly add it to the ChangeLog. Should be correct now.
>>
>>
>> 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.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2014-11-06  Renlin Li <Renlin.Li@arm.com>
>>     PR middle-end/61529
>>     * gcc.dg/pr61529.c: New.
>
>
> Hi,
>
> Can anybody help to review or approve this?
>
> Kind regards,
> Renlin Li
>
>
Jeff Law Nov. 11, 2014, 9:43 p.m. UTC | #3
On 11/10/14 09:59, Renlin Li wrote:
> On 06/11/14 18:07, Renlin Li wrote:
>> On 06/11/14 17:59, Teresa Johnson wrote:
>>> Thanks for fixing the test case. Can you also add the comment I
>>> suggested to the source change?
>>>
>>>> Please add a comment that this is needed due to insane incoming
>>>> frequencies.
>>>>
>>
>> Sorry, I mistakenly add it to the ChangeLog. Should be correct now.
>>
>>
>> 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.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2014-11-06  Renlin Li <Renlin.Li@arm.com>
>>     PR middle-end/61529
>>     * gcc.dg/pr61529.c: New.
>
> Hi,
>
> Can anybody help to review or approve this?
Per my message on Nov 4, it's approved with the testcase.
jeff
diff mbox

Patch

commit 35614b9b49d2478ad30225e4a3e864cd5df2e67f
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..3e20916 100644
--- a/gcc/tree-ssa-threadupdate.c
+++ b/gcc/tree-ssa-threadupdate.c
@@ -730,6 +730,11 @@  compute_path_counts (struct redirection_data *rd,
             nonpath_count += ein->count;
         }
     }
+
+  /* This is needed due to insane incoming frequencies.  */
+  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