On Sat, Jul 23, 2016 at 2:40 PM, Patrick Palka <patr...@parcs.ath.cx> wrote: > 1. When dumping assert details, print loc->expr instead of the bare SSA > name. loc->expr is not always equal to the SSA name. For example we > sometimes insert an ASSERT_EXPR like > > x_7 = ASSERT_EXPR <x_4(D), (unsigned int) x_4(D) + 4294967295 > 8>; > > The diff of the new dump output looks like: > > Assertions to be inserted for x_4(D) > if (_4 <= 8) > > BB #3 > EDGE 2->3 2 [39.0%] (FALSE_VALUE,EXECUTABLE) > - PREDICATE: x_4(D) gt_expr 8 > + PREDICATE: (unsigned int) x_4(D) + 4294967295 gt_expr 8 > > 2. In extract_code_and_val_from_cond_with_ops verify that name is equal to > either cond_op0 or cond_op1. If name is not equal to one of these > operands then its caller register_edge_assert_for will malfunction and > the wrong assertion will get inserted. > > Is this OK to commit after bootstrap + regtesting?
Ok. Richard. > gcc/ChangeLog: > > * tree-vrp.c (dump_asserts_for): Print loc->expr instead of > name. > (extract_code_and_val_from_cond_with_ops): Verify that name is > either cond_op0 or cond_op1. > --- > gcc/tree-vrp.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c > index a3068ec..5072370 100644 > --- a/gcc/tree-vrp.c > +++ b/gcc/tree-vrp.c > @@ -4827,7 +4827,7 @@ dump_asserts_for (FILE *file, tree name) > dump_edge_info (file, loc->e, dump_flags, 0); > } > fprintf (file, "\n\tPREDICATE: "); > - print_generic_expr (file, name, 0); > + print_generic_expr (file, loc->expr, 0); > fprintf (file, " %s ", get_tree_code_name (loc->comp_code)); > print_generic_expr (file, loc->val, 0); > fprintf (file, "\n\n"); > @@ -5009,13 +5009,15 @@ extract_code_and_val_from_cond_with_ops (tree name, > enum tree_code cond_code, > comp_code = swap_tree_comparison (cond_code); > val = cond_op0; > } > - else > + else if (name == cond_op0) > { > /* The comparison is of the form NAME COMP VAL, so the > comparison code remains unchanged. */ > comp_code = cond_code; > val = cond_op1; > } > + else > + gcc_unreachable (); > > /* Invert the comparison code as necessary. */ > if (invert) > -- > 2.9.2.413.g76d2a70 >