* Patch to extend the fix PR53676 to unsigned char
@ 2013-04-22 16:24 Laurent Alfonsi
2013-04-22 16:54 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Laurent Alfonsi @ 2013-04-22 16:24 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 719 bytes --]
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.
Regards,
Laurent
[-- Attachment #2: 53676-extension.patch --]
[-- Type: text/x-patch, Size: 1361 bytes --]
--- 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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Patch to extend the fix PR53676 to unsigned char
2013-04-22 16:24 Patch to extend the fix PR53676 to unsigned char Laurent Alfonsi
@ 2013-04-22 16:54 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2013-04-22 16:54 UTC (permalink / raw)
To: Laurent Alfonsi; +Cc: gcc-patches
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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-22 15:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-22 16:24 Patch to extend the fix PR53676 to unsigned char Laurent Alfonsi
2013-04-22 16:54 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).