diff mbox

Fix the bug to check if lookup_stmt_eh_lp returns positive instead of non-zero

Message ID CAO2gOZWPHPqtG-nKnGQs9FuKRRH_-d4MijyFkCZ4+BOYrSe9+A@mail.gmail.com
State New
Headers show

Commit Message

Dehao Chen July 9, 2013, 12:55 a.m. UTC
In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW
region index. In this case, we should *not* add an EH edge during VPT.

Bootstrapped and passed regression test.

OK for trunk?

Thanks,
Dehao

gcc/ChangeLog:

2013-07-08  Dehao Chen (dehao@google.com)

        * value-prof.c (gimple_ic): Fix the bug of adding EH edge.

Comments

Xinliang David Li July 9, 2013, 4:33 a.m. UTC | #1
Is it possible to add a test case?

David

On Mon, Jul 8, 2013 at 5:55 PM, Dehao Chen <dehao@google.com> wrote:
> In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW
> region index. In this case, we should *not* add an EH edge during VPT.
>
> Bootstrapped and passed regression test.
>
> OK for trunk?
>
> Thanks,
> Dehao
>
> gcc/ChangeLog:
>
> 2013-07-08  Dehao Chen (dehao@google.com)
>
>         * value-prof.c (gimple_ic): Fix the bug of adding EH edge.
>
> Index: gcc/value-prof.c
> ===================================================================
> --- gcc/value-prof.c (revision 200375)
> +++ gcc/value-prof.c (working copy)
> @@ -1359,8 +1359,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *
>
>    /* Build an EH edge for the direct call if necessary.  */
>    lp_nr = lookup_stmt_eh_lp (icall_stmt);
> -  if (lp_nr != 0
> -      && stmt_could_throw_p (dcall_stmt))
> +  if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt))
>      {
>        edge e_eh, e;
>        edge_iterator ei;
Dehao Chen July 9, 2013, 10:40 p.m. UTC | #2
I tried to make a small testcase to reproduce this. But the GCC EH
handling of ERT_MUST_NOT_THROW is not working properly. In my
unittest, it will not set this flag to the destructor... Thus the
problem cannot be reproduced.

Dehao

On Mon, Jul 8, 2013 at 9:33 PM, Xinliang David Li <davidxl@google.com> wrote:
> Is it possible to add a test case?
>
> David
>
> On Mon, Jul 8, 2013 at 5:55 PM, Dehao Chen <dehao@google.com> wrote:
>> In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW
>> region index. In this case, we should *not* add an EH edge during VPT.
>>
>> Bootstrapped and passed regression test.
>>
>> OK for trunk?
>>
>> Thanks,
>> Dehao
>>
>> gcc/ChangeLog:
>>
>> 2013-07-08  Dehao Chen (dehao@google.com)
>>
>>         * value-prof.c (gimple_ic): Fix the bug of adding EH edge.
>>
>> Index: gcc/value-prof.c
>> ===================================================================
>> --- gcc/value-prof.c (revision 200375)
>> +++ gcc/value-prof.c (working copy)
>> @@ -1359,8 +1359,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *
>>
>>    /* Build an EH edge for the direct call if necessary.  */
>>    lp_nr = lookup_stmt_eh_lp (icall_stmt);
>> -  if (lp_nr != 0
>> -      && stmt_could_throw_p (dcall_stmt))
>> +  if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt))
>>      {
>>        edge e_eh, e;
>>        edge_iterator ei;
Dehao Chen July 17, 2013, 12:40 a.m. UTC | #3
ping...

Thanks,
Dehao

On Mon, Jul 8, 2013 at 5:55 PM, Dehao Chen <dehao@google.com> wrote:
> In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW
> region index. In this case, we should *not* add an EH edge during VPT.
>
> Bootstrapped and passed regression test.
>
> OK for trunk?
>
> Thanks,
> Dehao
>
> gcc/ChangeLog:
>
> 2013-07-08  Dehao Chen (dehao@google.com)
>
>         * value-prof.c (gimple_ic): Fix the bug of adding EH edge.
>
> Index: gcc/value-prof.c
> ===================================================================
> --- gcc/value-prof.c (revision 200375)
> +++ gcc/value-prof.c (working copy)
> @@ -1359,8 +1359,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *
>
>    /* Build an EH edge for the direct call if necessary.  */
>    lp_nr = lookup_stmt_eh_lp (icall_stmt);
> -  if (lp_nr != 0
> -      && stmt_could_throw_p (dcall_stmt))
> +  if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt))
>      {
>        edge e_eh, e;
>        edge_iterator ei;
Dehao Chen July 27, 2013, 1:15 a.m. UTC | #4
ping^2

Thanks,
Dehao

On Tue, Jul 16, 2013 at 5:40 PM, Dehao Chen <dehao@google.com> wrote:
> ping...
>
> Thanks,
> Dehao
>
> On Mon, Jul 8, 2013 at 5:55 PM, Dehao Chen <dehao@google.com> wrote:
>> In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW
>> region index. In this case, we should *not* add an EH edge during VPT.
>>
>> Bootstrapped and passed regression test.
>>
>> OK for trunk?
>>
>> Thanks,
>> Dehao
>>
>> gcc/ChangeLog:
>>
>> 2013-07-08  Dehao Chen (dehao@google.com)
>>
>>         * value-prof.c (gimple_ic): Fix the bug of adding EH edge.
>>
>> Index: gcc/value-prof.c
>> ===================================================================
>> --- gcc/value-prof.c (revision 200375)
>> +++ gcc/value-prof.c (working copy)
>> @@ -1359,8 +1359,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *
>>
>>    /* Build an EH edge for the direct call if necessary.  */
>>    lp_nr = lookup_stmt_eh_lp (icall_stmt);
>> -  if (lp_nr != 0
>> -      && stmt_could_throw_p (dcall_stmt))
>> +  if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt))
>>      {
>>        edge e_eh, e;
>>        edge_iterator ei;
Dehao Chen Aug. 13, 2013, 4:04 p.m. UTC | #5
ping ^3

Thanks,
Dehao

On Fri, Jul 26, 2013 at 6:15 PM, Dehao Chen <dehao@google.com> wrote:
> ping^2
>
> Thanks,
> Dehao
>
> On Tue, Jul 16, 2013 at 5:40 PM, Dehao Chen <dehao@google.com> wrote:
>> ping...
>>
>> Thanks,
>> Dehao
>>
>> On Mon, Jul 8, 2013 at 5:55 PM, Dehao Chen <dehao@google.com> wrote:
>>> In lookup_stmt_eh_lp, negative return value indicates a MUST_NOT_THROW
>>> region index. In this case, we should *not* add an EH edge during VPT.
>>>
>>> Bootstrapped and passed regression test.
>>>
>>> OK for trunk?
>>>
>>> Thanks,
>>> Dehao
>>>
>>> gcc/ChangeLog:
>>>
>>> 2013-07-08  Dehao Chen (dehao@google.com)
>>>
>>>         * value-prof.c (gimple_ic): Fix the bug of adding EH edge.
>>>
>>> Index: gcc/value-prof.c
>>> ===================================================================
>>> --- gcc/value-prof.c (revision 200375)
>>> +++ gcc/value-prof.c (working copy)
>>> @@ -1359,8 +1359,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *
>>>
>>>    /* Build an EH edge for the direct call if necessary.  */
>>>    lp_nr = lookup_stmt_eh_lp (icall_stmt);
>>> -  if (lp_nr != 0
>>> -      && stmt_could_throw_p (dcall_stmt))
>>> +  if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt))
>>>      {
>>>        edge e_eh, e;
>>>        edge_iterator ei;
diff mbox

Patch

Index: gcc/value-prof.c
===================================================================
--- gcc/value-prof.c (revision 200375)
+++ gcc/value-prof.c (working copy)
@@ -1359,8 +1359,7 @@  gimple_ic (gimple icall_stmt, struct cgraph_node *

   /* Build an EH edge for the direct call if necessary.  */
   lp_nr = lookup_stmt_eh_lp (icall_stmt);
-  if (lp_nr != 0
-      && stmt_could_throw_p (dcall_stmt))
+  if (lp_nr > 0 && stmt_could_throw_p (dcall_stmt))
     {
       edge e_eh, e;
       edge_iterator ei;