http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48006
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |INVALID --- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-07 10:23:11 UTC --- I think what you are seeing is type-based alias analysis at work. When using unsigned long long you get no aliasing of the accesses to *rows to the nrows, ncols ... members (they use size_t which is unsigned long). But as soon as you change the typedef to unsigned long (which means the same type as size_t) then the compiler has to assume all stores to *rows alias the size_t members and so their loads are not hoisted out of the loop. You should probably try to play with restrict qualifying some of the pointers to tell the compiler that *rows does not point to nrows.