public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch gimplify]: Fix for PR/48984
@ 2011-05-13  9:23 Kai Tietz
  2011-05-13  9:23 ` Eric Botcazou
  2011-05-13 13:58 ` H.J. Lu
  0 siblings, 2 replies; 6+ messages in thread
From: Kai Tietz @ 2011-05-13  9:23 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Guenther, H.J. Lu

Hello,

this patch fixes the issue reported in PR/48984.  Issue is that
fortran has multiple BOOLEAN_TYPE'ed types with different modes. So
the check for BOOLEAN_TYPE in gimplification is wrong and instead we
need to check for identify to boolean_type_node.

ChangeLog

2011-05-13  Kai Tietz

        * gimplify.c (gimplify_expr): Check for boolean_type_node instead
        for BOOLEAN_TYPE for TRUTH-NOT/AND/OR/XOR.
        (gimple_boolify): Check for cast for boolean_type_node instead for
        BOOLEAN_TYPE.

Bootstrap passed and now doing fortran testsuite run to verify.

Regards,
Kai

Index: gimplify.c
===================================================================
--- gimplify.c	(revision 173711)
+++ gimplify.c	(working copy)
@@ -2848,7 +2848,7 @@
     default:
       /* Other expressions that get here must have boolean values, but
 	 might need to be converted to the appropriate mode.  */
-      if (TREE_CODE (type) == BOOLEAN_TYPE)
+      if (type == boolean_type_node)
 	return expr;
       return fold_convert_loc (loc, boolean_type_node, expr);
     }
@@ -6754,7 +6754,7 @@
 	  }

 	case TRUTH_NOT_EXPR:
-	  if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE)
+	  if (TREE_TYPE (*expr_p) != boolean_type_node)
 	    {
 	      tree type = TREE_TYPE (*expr_p);
 	      *expr_p = fold_convert (type, gimple_boolify (*expr_p));
@@ -7199,7 +7199,7 @@
 	       fold_truth_not_expr) happily uses operand type and doesn't
 	       automatically uses boolean_type as result, we need to keep
 	       orignal type.  */
-	    if (TREE_CODE (org_type) != BOOLEAN_TYPE)
+	    if (org_type != boolean_type_node)
 	      {
 		*expr_p = fold_convert (org_type, *expr_p);
 		ret = GS_OK;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch gimplify]: Fix for PR/48984
  2011-05-13  9:23 [patch gimplify]: Fix for PR/48984 Kai Tietz
@ 2011-05-13  9:23 ` Eric Botcazou
  2011-05-13 10:20   ` Richard Guenther
  2011-05-13 13:58 ` H.J. Lu
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Botcazou @ 2011-05-13  9:23 UTC (permalink / raw)
  To: Kai Tietz; +Cc: gcc-patches, Richard Guenther, H.J. Lu

> 2011-05-13  Kai Tietz
>
>         * gimplify.c (gimplify_expr): Check for boolean_type_node instead
>         for BOOLEAN_TYPE for TRUTH-NOT/AND/OR/XOR.
>         (gimple_boolify): Check for cast for boolean_type_node instead for
>         BOOLEAN_TYPE.

Missing PR middle-end/48984 at the top.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch gimplify]: Fix for PR/48984
  2011-05-13  9:23 ` Eric Botcazou
@ 2011-05-13 10:20   ` Richard Guenther
  2011-05-13 10:25     ` Kai Tietz
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Guenther @ 2011-05-13 10:20 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Kai Tietz, gcc-patches, H.J. Lu

On Fri, May 13, 2011 at 8:56 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> 2011-05-13  Kai Tietz
>>
>>         * gimplify.c (gimplify_expr): Check for boolean_type_node instead
>>         for BOOLEAN_TYPE for TRUTH-NOT/AND/OR/XOR.
>>         (gimple_boolify): Check for cast for boolean_type_node instead for
>>         BOOLEAN_TYPE.
>
> Missing PR middle-end/48984 at the top.

Ok with that change.

Richard.

> --
> Eric Botcazou
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch gimplify]: Fix for PR/48984
  2011-05-13 10:20   ` Richard Guenther
@ 2011-05-13 10:25     ` Kai Tietz
  0 siblings, 0 replies; 6+ messages in thread
From: Kai Tietz @ 2011-05-13 10:25 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Eric Botcazou, gcc-patches, H.J. Lu

2011/5/13 Richard Guenther <richard.guenther@gmail.com>:
> On Fri, May 13, 2011 at 8:56 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>> 2011-05-13  Kai Tietz
>>>
>>>         * gimplify.c (gimplify_expr): Check for boolean_type_node instead
>>>         for BOOLEAN_TYPE for TRUTH-NOT/AND/OR/XOR.
>>>         (gimple_boolify): Check for cast for boolean_type_node instead for
>>>         BOOLEAN_TYPE.
>>
>> Missing PR middle-end/48984 at the top.
>
> Ok with that change.
>
> Richard.
>
>> --
>> Eric Botcazou
>>

After testsuite run for fortran passed. Applied fix at revision 173726.

Regards,
Kai

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch gimplify]: Fix for PR/48984
  2011-05-13  9:23 [patch gimplify]: Fix for PR/48984 Kai Tietz
  2011-05-13  9:23 ` Eric Botcazou
@ 2011-05-13 13:58 ` H.J. Lu
  2011-05-13 13:59   ` Richard Guenther
  1 sibling, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2011-05-13 13:58 UTC (permalink / raw)
  To: Kai Tietz; +Cc: GCC Patches, Richard Guenther

On Thu, May 12, 2011 at 11:59 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hello,
>
> this patch fixes the issue reported in PR/48984.  Issue is that
> fortran has multiple BOOLEAN_TYPE'ed types with different modes. So
> the check for BOOLEAN_TYPE in gimplification is wrong and instead we
> need to check for identify to boolean_type_node.
>
> ChangeLog
>
> 2011-05-13  Kai Tietz
>
>        * gimplify.c (gimplify_expr): Check for boolean_type_node instead
>        for BOOLEAN_TYPE for TRUTH-NOT/AND/OR/XOR.
>        (gimple_boolify): Check for cast for boolean_type_node instead for
>        BOOLEAN_TYPE.
>
> Bootstrap passed and now doing fortran testsuite run to verify.

It isn't completed fixed. I still got

FAIL: gcc.dg/tree-ssa/vrp47.c scan-tree-dump-times dom1 "x[^ ]* & y" 1

with revision 173729.

-- 
H.J.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch gimplify]: Fix for PR/48984
  2011-05-13 13:58 ` H.J. Lu
@ 2011-05-13 13:59   ` Richard Guenther
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Guenther @ 2011-05-13 13:59 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Kai Tietz, GCC Patches

On Fri, May 13, 2011 at 3:17 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, May 12, 2011 at 11:59 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Hello,
>>
>> this patch fixes the issue reported in PR/48984.  Issue is that
>> fortran has multiple BOOLEAN_TYPE'ed types with different modes. So
>> the check for BOOLEAN_TYPE in gimplification is wrong and instead we
>> need to check for identify to boolean_type_node.
>>
>> ChangeLog
>>
>> 2011-05-13  Kai Tietz
>>
>>        * gimplify.c (gimplify_expr): Check for boolean_type_node instead
>>        for BOOLEAN_TYPE for TRUTH-NOT/AND/OR/XOR.
>>        (gimple_boolify): Check for cast for boolean_type_node instead for
>>        BOOLEAN_TYPE.
>>
>> Bootstrap passed and now doing fortran testsuite run to verify.
>
> It isn't completed fixed. I still got
>
> FAIL: gcc.dg/tree-ssa/vrp47.c scan-tree-dump-times dom1 "x[^ ]* & y" 1
>
> with revision 173729.

That's now

  D.2716_9 = (_Bool) x_2(D);
  D.2717_10 = (_Bool) y_5(D);
  D.2718_11 = D.2716_9 & D.2717_10;
  D.2715_12 = (int) D.2718_11;

instead of

  x_9 = x_2(D);
  y_10 = y_5(D);
  D.2715_11 = x_2(D) & y_5(D);

before.  VRP does not optimize the above to the latter even if it would
know that x_2 and y_5 are both [0,1] (for some reason it thinks they
are varying).  Before VRP we had

  D.2716_9 = x_13 != 0;
  D.2717_10 = y_14 != 0;
  D.2715_11 = D.2716_9 && D.2717_10;

which helped VRP see that for _9 and _10 and thus it folded the
truth and to a bitwise and test.

This kind of fallout is expected but we should find a way to address
it.

Richard.

> --
> H.J.
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-13 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-13  9:23 [patch gimplify]: Fix for PR/48984 Kai Tietz
2011-05-13  9:23 ` Eric Botcazou
2011-05-13 10:20   ` Richard Guenther
2011-05-13 10:25     ` Kai Tietz
2011-05-13 13:58 ` H.J. Lu
2011-05-13 13:59   ` Richard Guenther

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