https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69564
--- Comment #33 from Richard Biener <rguenth at gcc dot gnu.org> --- For example with Index: tree-vect-loop-manip.c =================================================================== --- tree-vect-loop-manip.c (revision 245501) +++ tree-vect-loop-manip.c (working copy) @@ -2187,6 +2187,14 @@ create_intersect_range_checks (loop_vec_ tree addr_base_b = DR_BASE_ADDRESS (dr_b.dr); tree offset_a = DR_OFFSET (dr_a.dr), offset_b = DR_OFFSET (dr_b.dr); + if (TREE_CODE (addr_base_a) == POINTER_PLUS_EXPR + && TREE_CODE (addr_base_b) == POINTER_PLUS_EXPR + && operand_equal_p (TREE_OPERAND (addr_base_a, 1), + TREE_OPERAND (addr_base_b, 1), 0)) + { + addr_base_a = TREE_OPERAND (addr_base_a, 0); + addr_base_b = TREE_OPERAND (addr_base_b, 0); + } offset_a = fold_build2 (PLUS_EXPR, TREE_TYPE (offset_a), offset_a, DR_INIT (dr_a.dr)); offset_b = fold_build2 (PLUS_EXPR, TREE_TYPE (offset_b), the versioning condition is simplified to _173 = (unsigned int) N_67(D); _162 = (unsigned int) j_94; _161 = _173 - _162; _160 = _161 + 4294967295; _159 = _160 > 8; _158 = prephitmp_172 + 24; _157 = Aii_81 + 8; _156 = _157 >= _158; _155 = Aii_81 + 24; _154 = prephitmp_172 + 8; _153 = _154 >= _155; _152 = _153 | _156; _151 = _152 & _159; if (_151 != 0) note that while the cost model check comes first (the > 8 compare) we do not separate that out into a GIMPLE_COND and RTL expansion might f*ck up condition ordering.