This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/26727] New: [4.2 Regression] gcc.target/powerpc/doloop-1.c fails
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2006 15:07:36 -0000
- Subject: [Bug rtl-optimization/26727] New: [4.2 Regression] gcc.target/powerpc/doloop-1.c fails
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I was looking through my testsuite results and noticed this fails.
We deinitely don't get a do loop at all:
L7:
addic. r0,r0,-1
add r4,r4,r2
addi r2,r2,1
bne- cr0,L7
L5:
......
blr
L6:
add r5,r5,r2
addi r2,r2,1
bdz L5
add r5,r5,r2
addi r2,r2,1
bdz L5
b L6
Really this testcase could be optimized even further to just:
if (count > 10)
pcb += count;
else if (count > 0)
pca += count;
But that is a different issue (and would cause this testcase to fail again
because then the testcase is not testing what it should be testing).
Anyways what we get in final_cleanup is:
<bb 2>:
if (count > 10) goto <L29>; else goto <L6>;
<L6>:;
if (count > 0) goto <L30>; else goto <L7>;
<L29>:;
i.39 = 1;
<L1>:;
pcb = (char *) i.39 + pcb;
i.39 = i.39 + 1;
if (i.39 != count) goto <L1>; else goto <L7>;
<L30>:;
i = 0;
<L5>:;
pca = (char *) i + pca;
i = i + 1;
if (i != count) goto <L5>; else goto <L7>;
Which obviously confuses the IV lookup on the rtl level.
Anyways here the testcase:
/* { dg-do compile { target powerpc*-*-* } } */
/* { dg-options "-O2" } */
void foo (int count, char* pca, char* pcb) {
int i;
if (count > 10)
for (i = 0; i < count; ++i)
pcb += i;
else
for (i = 0; i < count; ++i)
pca += i;
*pca = *pcb;
}
/* { dg-final { scan-assembler "bdnz" } } */
--
Summary: [4.2 Regression] gcc.target/powerpc/doloop-1.c fails
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
GCC target triplet: powerpc-darwin7.9.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26727