This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/26847] New: Missed optimization in simplify_plus_minus - regression against 4.1.0
- From: "krebbel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2006 15:06:26 -0000
- Subject: [Bug rtl-optimization/26847] New: Missed optimization in simplify_plus_minus - regression against 4.1.0
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
copied from:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00812.html
Hi Paolo,
with your patch:
http://gcc.gnu.org/ml/gcc-patches/2005-11/msg01718.html
simplify_plus_minus isn't able anymore to simplify things like (r1 + 8) - r1.
The function is left at:
if (!canonicalized)
{
int n_constants = 0;
for (i = 0; i < n_ops; i++)
if (GET_CODE (ops[i].op) == CONST_INT)
n_constants++;
if (n_constants <= 1)
return NULL_RTX;
}
because only a single constant was found and no canonicalization took place.
Your patch changed:
if (n_ops <= 2 && !force)
return NULL_RTX;
to:
gcc_assert (n_ops >= 2);
if (!canonicalized)
return NULL_RTX;
Which was later on changed by Alan Modra with:
http://gcc.gnu.org/ml/gcc-patches/2005-12/msg00015.html
to the version mentioned above. The reason here was that expressions
like reg + c1 + c2 were not simplified anymore.
So the new version exits always if the initial loop couldn't do any
canonicalization work and only 0 or 1 constants are left. What prevents
simplification in all those cases.
...
As Roger Sayle pointed out the patch I've proposed in the email isn't the
proper fix for this issue.
Paolo Bonzini already proposed a solution in:
http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00884.html
Thats why I'll assign the bug to him.
--
Summary: Missed optimization in simplify_plus_minus - regression
against 4.1.0
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: bonzini at gnu dot org
ReportedBy: krebbel at gcc dot gnu dot org
GCC build triplet: s390x-ibm-linux-gnu
GCC host triplet: s390x-ibm-linux-gnu
GCC target triplet: s390x-ibm-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26847