https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108017
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Related is optimizing: _1 = (long unsigned int) j_5(D); _2 = _1 * 4; t_7 = i_6(D) + _2; _3 = (long unsigned int) k_8(D); _4 = _3 * 4; t1_9 = i_6(D) + _4; _10 = MAX_EXPR <t_7, t1_9>; into: i_6(D) + MAX_EXPR <_2, _4> The non ptr_plus case is filed as PR 116008.