GCC3 to GCC4 performance regression. Bug?
Stefan Strasser
sstrasser@systemhaus-gruppe.de
Thu Mar 17 23:16:00 GMT 2005
Steve Ellcey schrieb:
> ------------------------ Test Case -----------------------
I think is the same bug(which was not considered one back then) as
benjamin redelings described in the thread "C++ math optimization
problem...".
there are again unnecessary memory accesses as if the memory were
volatile, which could be moved out of the inner loop.
and gcc 3.4 does it in this case(there are other cases where both fail,
see the math optimization thread)
and once again changes which shouldn't have any effect enormously affect
the inner loop.
>
> #define L_CONST 500
>
> void *malloc(long size);
>
> struct plan7_s {
> int M;
> int **tsc; /* transition scores [0.6][1.M-1] */
> };
>
> struct dpmatrix_s {
> int **mmx;
> };
> struct dpmatrix_s *mx;
>
>
>
> void
> AllocPlan7Body(struct plan7_s *hmm, int M)
> {
> int i;
>
> hmm->tsc = malloc (7 * sizeof(int *));
> hmm->tsc[0] = malloc ((M+16) * sizeof(int));
> mx->mmx = (int **) malloc(sizeof(int *) * (L_CONST+1));
> for (i = 0; i <= L_CONST; i++) {
> mx->mmx[i] = malloc (M+2+16);
> }
> return;
> }
>
> void
> P7Viterbi(int L, int M, struct plan7_s *hmm, int **mmx)
> {
> int i,k;
>
> for (i = 1; i <= L; i++) {
> for (k = 1; k <= M; k++) {
> mmx[i][k] = mmx[i-1][k-1] + hmm->tsc[0][k-1];
> }
> }
> }
>
> main ()
> {
> struct plan7_s *hmm;
> char dsq[L_CONST];
> int i;
>
> hmm = (struct plan7_s *) malloc (sizeof (struct plan7_s));
> mx = (struct dpmatrix_s *) malloc (sizeof (struct dpmatrix_s));
> AllocPlan7Body(hmm, 10);
> for (i = 0; i < 600000; i++) {
> P7Viterbi(500, 10, hmm, mx->mmx);
> }
> }
>
>
--
Stefan Strasser
More information about the Gcc
mailing list