------- Comment #2 from pinskia at gcc dot gnu dot org 2010-03-02 03:53 ------- I think what GCC is doing is correct as lsps could conflict with mul_q and base_q as lsps is not marked as restrict. Doing this: #include <string.h>
void dequant_lsps(double *__restrict lsps, int num, const unsigned short *values, int n_stages, const unsigned char * __restrict table, const double * __restrict mul_q, const double * __restrict base_q) { const unsigned char * __restrict t_off = &table[values[0] * num]; int m; memset(lsps, 0, num * sizeof(*lsps)); for (m = 0; m < num; m++) lsps[m] += base_q[0] + mul_q[0] * t_off[m]; } Allows GCC to optimize those loads away. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43224