https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123479
--- Comment #1 from Yi <652023330028 at smail dot nju.edu.cn> --- The following reduced test case seems exhibit a missed optimization due to a similar underlying cause. https://godbolt.org/z/hbj8aTfxj void d(long* g, long* d) { long n = d - g; for (long i = 0; i < n; i++) g[i] = n; } GCC -O3: <bb 2> [local count: 118111600]: _1 = d_7(D) - g_8(D); if (_1 > 0) goto <bb 3>; [89.00%] else goto <bb 9>; [11.00%] <bb 3> [local count: 105119324]: n_9 = _1 /[ex] 8; if (_1 <= 8) goto <bb 8>; [10.00%] else goto <bb 4>; [90.00%] <bb 4> [local count: 94607391]: _14 = _1 != 0; #redundant _13 = (unsigned long) n_9; niters.5_18 = _14 ? _13 : 1; bnd.6_29 = niters.5_18 >> 1; _32 = {n_9, n_9}; ivtmp.15_27 = (unsigned long) g_8(D); _2 = bnd.6_29 * 16; _4 = _2 + ivtmp.15_27;
