It's not that particular commit, but the previous one, but yeah, that's all me.

(gdb)
#4 0x000000000145bf44 in value_range_base::lower_bound (this=0x7fffffffc360,
    pair=0) at /home/cygnus/aldyh/src/gcc/gcc/tree-vrp.c:6148
6148      return wi::to_wide (t);
(gdb)
#5  0x0000000001ccb1d9 in range_operator::fold_range (
    this=0x271edc8 <op_plus>, type=<integer_type 0x7fffefd451f8>, lh=...,
    rh=...) at /home/cygnus/aldyh/src/gcc/gcc/range-op.cc:156
156             wide_int rh_lb = rh.lower_bound (y);
(gdb)
#6  0x000000000144b850 in range_fold_binary_expr (vr=0x7fffffffc6c0,
    code=PLUS_EXPR, expr_type=<integer_type 0x7fffefd451f8>,
    vr0_=0x7fffffffc480, vr1_=0x7fffffffc460)
    at /home/cygnus/aldyh/src/gcc/gcc/tree-vrp.c:1927
1927                            vr1.normalize_addresses ());
(gdb) l
1922 if (range_fold_binary_symbolics_p (vr, code, expr_type, &vr0, &vr1))
1923        return;
1924
1925      *vr = op->fold_range (expr_type,
1926                            vr0.normalize_addresses (),
1927                            vr1.normalize_addresses ());
1928    }
1929
1930    /* Perform a unary operation on a range.  */
1931
(gdb) print vr1.dump()
unsigned long [POLY_INT_CST [4, 4], POLY_INT_CST [4, 4]]$1 = void
(gdb)

We have a value_range_base containing a POLYT_INT_CST which we don't handle.

That's rather unfortunate. I was hoping by this point, anything we couldn't handle was just an address. The previous range-ops code was normalizing anything not INTEGER_CST into VARYING, which I thought was a rather big hammer, and was trying to avoid.

Interesting that the old VRP code also allowing the POLY_INT to pass on through all the way into extract_range_binary_expr, only to bail when it see's it's not an INTEGER_CST:

          && (TREE_CODE (max_op0) == INTEGER_CST
              || (sym_max_op0
                  = get_single_symbol (max_op0, &neg_max_op0, &max_op0)))
          && (TREE_CODE (max_op1) == INTEGER_CST
              || (sym_max_op1
                  = get_single_symbol (max_op1, &neg_max_op1, &max_op1)))

I guess we could bring out the big hammer again if normalize_addresses doesn't give us an INTEGER_CST.

I'll take a look at this.  Thanks for pointing it out.

Aldy

On 10/10/19 5:25 AM, Christophe Lyon wrote:


On Mon, 7 Oct 2019 at 13:53, Aldy Hernandez <al...@redhat.com <mailto:al...@redhat.com>> wrote:


     > +bool
     > +ipa_vr::nonzero_p (tree expr_type) const
     > +{
     > +  if (type == VR_ANTI_RANGE && wi::eq_p (min, 0) && wi::eq_p
    (max, 0))
     > +    return true;
     > +
     > +  unsigned prec = TYPE_PRECISION (expr_type);
     > +  return (type == VR_RANGE
     > +         && wi::eq_p (min, wi::one (prec))
     > +         && wi::eq_p (max, wi::max_value (prec, TYPE_SIGN
    (expr_type))));
     > +}

    Errr, wrong version posted.  There was a TYPE_UNSIGNED missing.

    Fixed and committed.


Hi,
Since this was committed (r276654), I've noticed regressions on aarch64:
     gcc.target/aarch64/pr88838.c (test for excess errors)
     gcc.target/aarch64/stack-check-cfa-3.c (test for excess errors)
     gcc.target/aarch64/stack-check-prologue-16.c (test for excess errors)
    gcc.target/aarch64/sve/abs_1.c -march=armv8.2-a+sve  scan-assembler-times \\tabs\\tz[0-9]+\\.b, p[0-7]/m, z[0-9]+\\.b\\n 1     gcc.target/aarch64/sve/abs_1.c -march=armv8.2-a+sve  scan-assembler-times \\tabs\\tz[0-9]+\\.d, p[0-7]/m, z[0-9]+\\.d\\n 1     gcc.target/aarch64/sve/abs_1.c -march=armv8.2-a+sve  scan-assembler-times \\tabs\\tz[0-9]+\\.h, p[0-7]/m, z[0-9]+\\.h\\n 1     gcc.target/aarch64/sve/abs_1.c -march=armv8.2-a+sve  scan-assembler-times \\tabs\\tz[0-9]+\\.s, p[0-7]/m, z[0-9]+\\.s\\n 1     gcc.target/aarch64/sve/abs_1.c -march=armv8.2-a+sve (test for excess errors)     gcc.target/aarch64/sve/adr_1.c -march=armv8.2-a+sve (test for excess errors)

and many others

For instance:
compiler exited with status 1
FAIL: gcc.target/aarch64/pr88838.c (internal compiler error)
FAIL: gcc.target/aarch64/pr88838.c (test for excess errors)
Excess errors:
during GIMPLE pass: dom
/gcc/testsuite/gcc.target/aarch64/pr88838.c:5:1: internal compiler error: tree check: expected integer_cst, have poly_int_cst in to_wide, at tree.h:5795 0x5efa71 tree_check_failed(tree_node const*, char const*, int, char const*, ...)
         /gcc/tree.c:9926
0x749584 tree_check(tree_node const*, char const*, int, char const*, tree_code)
         /gcc/tree.h:3523
0x749584 wi::to_wide(tree_node const*)
         /gcc/tree.h:5795
0xf7c0c0 value_range_base::lower_bound(unsigned int) const
         /gcc/tree-vrp.c:6136
0x155d2e6 range_operator::fold_range(tree_node*, value_range_base const&, value_range_base const&) const
         /gcc/range-op.cc:156
0xf87597 range_fold_binary_expr(value_range_base*, tree_code, tree_node*, value_range_base const*, value_range_base const*)
         /gcc/tree-vrp.c:1915
0x1007962 vr_values::extract_range_from_binary_expr(value_range*, tree_code, tree_node*, tree_node*, tree_node*)
         /gcc/vr-values.c:808
0x1011f0c vr_values::extract_range_from_assignment(value_range*, gassign*)
         /gcc/vr-values.c:1469
0x1499d21 evrp_range_analyzer::record_ranges_from_stmt(gimple*, bool)
         /gcc/gimple-ssa-evrp-analyze.c:307
0xdd76dd dom_opt_dom_walker::before_dom_children(basic_block_def*)
         /gcc/tree-ssa-dom.c:1503
0x146e68a dom_walker::walk(basic_block_def*)
         /gcc/domwalk.c:309
0xdd4759 execute
         /gcc/tree-ssa-dom.c:724

gcc.target/aarch64/pr88838.c: output file does not exist
UNRESOLVED: gcc.target/aarch64/pr88838.c scan-assembler-not sxtw

Christophe

    diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
    index 20a0bddcbab..5020f4a44d5 100644
    --- a/gcc/ipa-prop.c
    +++ b/gcc/ipa-prop.c
    @@ -5117,6 +5117,7 @@ ipa_vr::nonzero_p (tree expr_type) const

         unsigned prec = TYPE_PRECISION (expr_type);
         return (type == VR_RANGE
    +         && TYPE_UNSIGNED (expr_type)
                && wi::eq_p (min, wi::one (prec))
                && wi::eq_p (max, wi::max_value (prec, TYPE_SIGN
    (expr_type))));
       }

Reply via email to