https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104214
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:2e211a02290f3b3533b56c593fc7b95edb8593b0 commit r12-6858-g2e211a02290f3b3533b56c593fc7b95edb8593b0 Author: Richard Biener <rguent...@suse.de> Date: Tue Jan 25 11:55:28 2022 +0100 tree-optimization/104214 - amend PR100740 fix for pointer compares When we have a pointer relational compare we have stronger guarantees about overflow, in particular rewriting BASE0 + STEP0 cmp BASE1 + STEP1 as BASE0 + STEP0 - STEP1 cmp BASE1 is always valid and the new IV0 does not overflow. The patch basically reverts the previous change when pointers are involved, keeping only the more conservative handling for equality compares which can involve comparing different object addresses. 2022-01-25 Richard Biener <rguent...@suse.de> PR tree-optimization/104214 * tree-ssa-loop-niter.cc (number_of_iterations_cond): Use stronger guarantees for relational pointer compares when rewriting BASE0 + STEP0 cmp BASE1 + STEP1 as BASE0 + STEP0 - STEP1 cmp BASE1. * gcc.dg/vect/pr81196-2.c: New variant testcase only requiring vect_int.