This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/66646] New: small loop turned into memmove because of tree ldist
- From: "amker at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Jun 2015 02:31:42 +0000
- Subject: [Bug tree-optimization/66646] New: small loop turned into memmove because of tree ldist
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66646
Bug ID: 66646
Summary: small loop turned into memmove because of tree ldist
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: amker at gcc dot gnu.org
Target Milestone: ---
Considering below small case
int foo (int flag, char *a)
{
short i, j;
short l = 0;
if (flag == 1)
l = 3;
for (i = 0; i < 4; i++)
{
for (j = l - 1; j > 0; j--)
a[j] = a[j - 1];
a[0] = i;
}
}
After revision 224020, SCEV can recognize &a[j], &a[j-1]. pass ldist decides
to replace the inner loop with memmove. Since it's a small loop, most likely
this results in peformance regression. We need:
A) compute more accurate loop niter bound in such case so that optimizers know
it's small loop.
B) don't turn loop into mem* call if it's small loop.