[Bug tree-optimization/24609] Same value duplicated in two different registers
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 1 14:54:00 GMT 2005
------- Comment #2 from pinskia at gcc dot gnu dot org 2005-11-01 14:54 -------
Actually it is "int*" and "int" and that mainly comes down to how we repesent
(int*)[d];
If we change the code (we should be able to do this in the IR also, Daniel
Berlin had a patch which did it):
extern int abs (int __x);
extern int bar (short*, short, int);
struct s
{
short int* top;
short int* left;
short int* diag;
};
typedef int aar[];
typedef aar *aptr;
typedef char par[];
typedef par *pptr;
int
foo (int *a, struct s* p, short int pv[6][16])
{
int s = 0;
int b;
aptr a1;
a1 = (aptr)(a);
pptr p1= (pptr)(p);
for (b = 0; b < 6; ++b)
{
int d;
short int ps;
if (abs (p->left[0] - p->diag[0])
< abs (p->diag[0] - p->top[0]))
d = 1;
else
d = 2;
(*a1)[b] = d;
ps = (*p1)[d - 1];
s += bar (pv[b], ps, a[b]);
}
return s;
}
--
We get:
.L12:
movl $1, %eax
xorl %edx, %edx
.....
jl .L12
movl $2, %eax
movl $1, %edx
jmp .L5
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24609
More information about the Gcc-bugs
mailing list