The following patch makes the VRP dump less vertical space noisy.
It also makes handling of the two forms of copies,

  a_1 = b_2;

and

  a_1 = PHI <b_2>

behave more similar by also copying VR_UNDEFINED ranges in the
first case and by creating a [b_2, b_2] symbolic range in
the second case (if b_2 has a VR_VARYING range).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2014-05-28  Richard Biener  <rguent...@suse.de>

        * tree-ssa-propagate.c (add_control_edge): Print less vertical space.
        * tree-vrp.c (extract_range_from_ssa_name): Also copy VR_UNDEFINED.
        (vrp_visit_assignment_or_call): Print less vertical space.
        (vrp_visit_stmt): Likewise.
        (vrp_visit_phi_node): Likewise.  For a PHI argument with
        VR_VARYING range consider recording it as copy.

Index: gcc/tree-ssa-propagate.c
===================================================================
*** gcc/tree-ssa-propagate.c    (revision 211015)
--- gcc/tree-ssa-propagate.c    (working copy)
*************** add_control_edge (edge e)
*** 301,307 ****
    cfg_blocks_add (bb);
  
    if (dump_file && (dump_flags & TDF_DETAILS))
!     fprintf (dump_file, "Adding Destination of edge (%d -> %d) to 
worklist\n\n",
        e->src->index, e->dest->index);
  }
  
--- 301,307 ----
    cfg_blocks_add (bb);
  
    if (dump_file && (dump_flags & TDF_DETAILS))
!     fprintf (dump_file, "\nAdding Destination of edge (%d -> %d) to 
worklist\n",
        e->src->index, e->dest->index);
  }
  
Index: gcc/tree-vrp.c
===================================================================
*** gcc/tree-vrp.c      (revision 211015)
--- gcc/tree-vrp.c      (working copy)
*************** extract_range_from_ssa_name (value_range
*** 1810,1816 ****
  {
    value_range_t *var_vr = get_value_range (var);
  
!   if (var_vr->type != VR_UNDEFINED && var_vr->type != VR_VARYING)
      copy_value_range (vr, var_vr);
    else
      set_value_range (vr, VR_RANGE, var, var, NULL);
--- 1810,1816 ----
  {
    value_range_t *var_vr = get_value_range (var);
  
!   if (var_vr->type != VR_VARYING)
      copy_value_range (vr, var_vr);
    else
      set_value_range (vr, VR_RANGE, var, var, NULL);
*************** vrp_visit_assignment_or_call (gimple stm
*** 6679,6685 ****
              print_generic_expr (dump_file, lhs, 0);
              fprintf (dump_file, ": ");
              dump_value_range (dump_file, &new_vr);
!             fprintf (dump_file, "\n\n");
            }
  
          if (new_vr.type == VR_VARYING)
--- 6679,6685 ----
              print_generic_expr (dump_file, lhs, 0);
              fprintf (dump_file, ": ");
              dump_value_range (dump_file, &new_vr);
!             fprintf (dump_file, "\n");
            }
  
          if (new_vr.type == VR_VARYING)
*************** vrp_visit_stmt (gimple stmt, edge *taken
*** 7473,7479 ****
      {
        fprintf (dump_file, "\nVisiting statement:\n");
        print_gimple_stmt (dump_file, stmt, 0, dump_flags);
-       fprintf (dump_file, "\n");
      }
  
    if (!stmt_interesting_for_vrp (stmt))
--- 7473,7478 ----
*************** vrp_visit_phi_node (gimple phi)
*** 8242,8248 ****
        if (dump_file && (dump_flags & TDF_DETAILS))
        {
          fprintf (dump_file,
!             "\n    Argument #%d (%d -> %d %sexecutable)\n",
              (int) i, e->src->index, e->dest->index,
              (e->flags & EDGE_EXECUTABLE) ? "" : "not ");
        }
--- 8241,8247 ----
        if (dump_file && (dump_flags & TDF_DETAILS))
        {
          fprintf (dump_file,
!             "    Argument #%d (%d -> %d %sexecutable)\n",
              (int) i, e->src->index, e->dest->index,
              (e->flags & EDGE_EXECUTABLE) ? "" : "not ");
        }
*************** vrp_visit_phi_node (gimple phi)
*** 8260,8275 ****
              /* Do not allow equivalences or symbolic ranges to leak in from
                 backedges.  That creates invalid equivalencies.
                 See PR53465 and PR54767.  */
!             if (e->flags & EDGE_DFS_BACK
!                 && (vr_arg.type == VR_RANGE
!                     || vr_arg.type == VR_ANTI_RANGE))
                {
!                 vr_arg.equiv = NULL;
!                 if (symbolic_range_p (&vr_arg))
                    {
!                     vr_arg.type = VR_VARYING;
!                     vr_arg.min = NULL_TREE;
!                     vr_arg.max = NULL_TREE;
                    }
                }
            }
--- 8259,8288 ----
              /* Do not allow equivalences or symbolic ranges to leak in from
                 backedges.  That creates invalid equivalencies.
                 See PR53465 and PR54767.  */
!             if (e->flags & EDGE_DFS_BACK)
                {
!                 if (vr_arg.type == VR_RANGE
!                     || vr_arg.type == VR_ANTI_RANGE)
                    {
!                     vr_arg.equiv = NULL;
!                     if (symbolic_range_p (&vr_arg))
!                       {
!                         vr_arg.type = VR_VARYING;
!                         vr_arg.min = NULL_TREE;
!                         vr_arg.max = NULL_TREE;
!                       }
!                   }
!               }
!             else
!               {
!                 /* If the non-backedge arguments range is VR_VARYING then
!                    we can still try recording a simple equivalence.  */
!                 if (vr_arg.type == VR_VARYING)
!                   {
!                     vr_arg.type = VR_RANGE;
!                     vr_arg.min = arg;
!                     vr_arg.max = arg;
!                     vr_arg.equiv = NULL;
                    }
                }
            }
*************** vrp_visit_phi_node (gimple phi)
*** 8288,8294 ****
            {
              fprintf (dump_file, "\t");
              print_generic_expr (dump_file, arg, dump_flags);
!             fprintf (dump_file, "\n\tValue: ");
              dump_value_range (dump_file, &vr_arg);
              fprintf (dump_file, "\n");
            }
--- 8301,8307 ----
            {
              fprintf (dump_file, "\t");
              print_generic_expr (dump_file, arg, dump_flags);
!             fprintf (dump_file, ": ");
              dump_value_range (dump_file, &vr_arg);
              fprintf (dump_file, "\n");
            }
*************** update_range:
*** 8396,8402 ****
          print_generic_expr (dump_file, lhs, 0);
          fprintf (dump_file, ": ");
          dump_value_range (dump_file, &vr_result);
!         fprintf (dump_file, "\n\n");
        }
  
        return SSA_PROP_INTERESTING;
--- 8409,8415 ----
          print_generic_expr (dump_file, lhs, 0);
          fprintf (dump_file, ": ");
          dump_value_range (dump_file, &vr_result);
!         fprintf (dump_file, "\n");
        }
  
        return SSA_PROP_INTERESTING;

Reply via email to