Message ID | 5175557B.7050201@st.com |
---|---|
State | New |
Headers | show |
On Mon, Apr 22, 2013 at 5:21 PM, Laurent Alfonsi <laurent.alfonsi@st.com> wrote: > The patch well fix the adobe_cpp performance regression on the int8_t type. > But the same degradation exists on uint8_t type, which is not fixed by the > patch referenced in PR53676. > > With the signed version, the code: > result_5 = (signed char) ((int) result_2 + 2) > is now well narrowed to: > result_5 = (signed char) ((unsigned char) result_2 + 2) > > But with the unsigned version: > result_5 = (unsigned char) ((int) result_2 + 2) > is not narrowed to: > result_5 = (unsigned char) ((unsigned char) result_2 + 2) > > As a consequence, result_5 is not detected as polynomial, and the loop is > not removed. > Tested on SH target. bootstrap + regression tests on > x86_64-unknown-linux-gnu in progress. Ok if testing succeeds, but please also adjust the comment before the 2nd hunk and add a testcase that fails before and succeeds after. Thanks, Richard. > Regards, > Laurent >
--- gcc.orig/gcc/tree-chrec.c 2013-04-22 13:20:03.000000000 +0200 +++ gcc/gcc/tree-chrec.c 2013-04-22 13:22:51.000000000 +0200 @@ -1346,13 +1346,12 @@ res = fold_build2 (TREE_CODE (chrec), type, fold_convert (type, TREE_OPERAND (chrec, 0)), fold_convert (type, TREE_OPERAND (chrec, 1))); - /* Similar perform the trick that (signed char)((int)x + 2) can be - narrowed to (signed char)((unsigned char)x + 2). */ + /* Similar perform the trick that ([un]signed char)((int)x + 2) can be + narrowed to ([un]signed char)((unsigned char)x + 2). */ else if (use_overflow_semantics && TREE_CODE (chrec) == POLYNOMIAL_CHREC && TREE_CODE (ct) == INTEGER_TYPE && TREE_CODE (type) == INTEGER_TYPE - && TYPE_OVERFLOW_UNDEFINED (type) && TYPE_PRECISION (type) < TYPE_PRECISION (ct)) { tree utype = unsigned_type_for (type); --- gcc.orig/gcc/tree-scalar-evolution.c 2013-04-22 13:20:12.000000000 +0200 +++ gcc/gcc/tree-scalar-evolution.c 2013-04-22 13:21:43.000000000 +0200 @@ -1767,7 +1767,6 @@ if (TREE_CODE (type) == INTEGER_TYPE && TREE_CODE (TREE_TYPE (rhs1)) == INTEGER_TYPE && TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (rhs1)) - && TYPE_OVERFLOW_UNDEFINED (type) && TREE_CODE (rhs1) == SSA_NAME && (def = SSA_NAME_DEF_STMT (rhs1)) && is_gimple_assign (def)