Jakub Jelinek <ja...@redhat.com> wrote: >Hi! > >This PR is about what I understood (can't reproduce, seems ltoish) >about reassoc now creating say _24 = (int) 0; with _Bool 0, and >forwprop ICEing on that. > >The patch fixes forwprop not to ICE on it (I think we don't require >the IL to be always folded), and reassoc not to create it in this case, >IMHO either hunk could fix the issue but haven't verified that. > >Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok. Thanks, Richard. >2013-11-22 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimization/59154 > * tree-ssa-reassoc.c (maybe_optimize_range_tests): When changing > rhs1 of a cast and new_op is invariant, fold_convert it. > * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Only call > simplify_conversion_from_bitmask if rhs1 is a SSA_NAME. > >--- gcc/tree-ssa-reassoc.c.jj 2013-11-22 13:15:55.000000000 +0100 >+++ gcc/tree-ssa-reassoc.c 2013-11-22 17:53:21.501637844 +0100 >@@ -2930,9 +2930,15 @@ maybe_optimize_range_tests (gimple stmt) > tree new_lhs = make_ssa_name (TREE_TYPE (lhs), NULL); > enum tree_code rhs_code > = gimple_assign_rhs_code (cast_stmt); >- gimple g >- = gimple_build_assign_with_ops (rhs_code, new_lhs, >- new_op, NULL_TREE); >+ gimple g; >+ if (is_gimple_min_invariant (new_op)) >+ { >+ new_op = fold_convert (TREE_TYPE (lhs), new_op); >+ g = gimple_build_assign (new_lhs, new_op); >+ } >+ else >+ g = gimple_build_assign_with_ops (rhs_code, new_lhs, >+ new_op, NULL_TREE); > gimple_stmt_iterator gsi = gsi_for_stmt (cast_stmt); > gimple_set_uid (g, gimple_uid (cast_stmt)); > gimple_set_visited (g, true); >--- gcc/tree-ssa-forwprop.c.jj 2013-11-22 13:15:55.000000000 +0100 >+++ gcc/tree-ssa-forwprop.c 2013-11-22 16:05:38.823559573 +0100 >@@ -3542,7 +3542,8 @@ ssa_forward_propagate_and_combine (void) > { > tree outer_type = TREE_TYPE (gimple_assign_lhs (stmt)); > tree inner_type = TREE_TYPE (gimple_assign_rhs1 (stmt)); >- if (INTEGRAL_TYPE_P (outer_type) >+ if (TREE_CODE (gimple_assign_rhs1 (stmt)) == SSA_NAME >+ && INTEGRAL_TYPE_P (outer_type) > && INTEGRAL_TYPE_P (inner_type) > && (TYPE_PRECISION (outer_type) > <= TYPE_PRECISION (inner_type))) > > Jakub