Message ID | BANLkTinEMSM2yQ85BwiM2FJSeu1+xe=DVg@mail.gmail.com |
---|---|
State | New |
Headers | show |
> 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.
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 >
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
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.
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. >
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;