https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106187
Richard Earnshaw <rearnsha at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #26 from Richard Earnshaw <rearnsha at gcc dot gnu.org> --- git bisect points to commit r11-9688 resolving the issue. Before that commit the ivopts pass generates: ivtmp.761_217 = (unsigned int) &au; _222 = &bu + 4; ivtmp.767_220 = (unsigned int) _222; _225 = (unsigned int) &au; _228 = _225 + 16; <bb 9> [local count: 858993457]: # prephitmp_136 = PHI <pretmp_120(10), 1073741824(8)> # prephitmp_32 = PHI <pretmp_18(10), 2147483648(8)> # ivtmp.761_278 = PHI <ivtmp.761_216(10), ivtmp.761_217(8)> # ivtmp.767_218 = PHI <ivtmp.767_219(10), ivtmp.767_220(8)> _16 = prephitmp_32 ^ prephitmp_136; _223 = (void *) ivtmp.761_278; MEM[(unsigned int *)_223] = _16; ivtmp.761_216 = ivtmp.761_278 + 4; if (ivtmp.761_216 != _228) goto <bb 10>; [75.00%] else goto <bb 11>; [25.00%] <bb 10> [local count: 644245086]: _230 = (void *) ivtmp.761_216; pretmp_120 = MEM[(unsigned int *)_230]; _229 = (void *) ivtmp.767_218; pretmp_18 = MEM[(unsigned int *)_229]; ivtmp.767_219 = ivtmp.767_218 + 4; goto <bb 9>; [100.00%] And once that patch is applied we get: ivtmp.761_217 = (unsigned int) &au; ivtmp.766_220 = (unsigned int) &bu; _223 = (unsigned int) &au; _225 = _223 + 16; <bb 9> [local count: 858993457]: # prephitmp_136 = PHI <pretmp_120(10), 1073741824(8)> # prephitmp_32 = PHI <pretmp_18(10), 2147483648(8)> # ivtmp.761_278 = PHI <ivtmp.761_216(10), ivtmp.761_217(8)> # ivtmp.766_218 = PHI <ivtmp.766_219(10), ivtmp.766_220(8)> _16 = prephitmp_32 ^ prephitmp_136; _222 = (void *) ivtmp.761_278; MEM[(unsigned int *)_222] = _16; ivtmp.761_216 = ivtmp.761_278 + 4; if (ivtmp.761_216 != _225) goto <bb 10>; [75.00%] else goto <bb 11>; [25.00%] The main difference being that in the 'bad' code we start with &bu + 4, while in the good code we start with &bu. I'm afraid I don't know enough about this code to take this further. Richi?