]> gcc.gnu.org Git - gcc.git/commit
tree-optimization/104214 - amend PR100740 fix for pointer compares
authorRichard Biener <rguenther@suse.de>
Tue, 25 Jan 2022 10:55:28 +0000 (11:55 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 25 Jan 2022 11:22:30 +0000 (12:22 +0100)
commit2e211a02290f3b3533b56c593fc7b95edb8593b0
tree10fa414be8c6b4859f546c81295cae36bca4059c
parentab2a2457780d224343ce05e7d8e2964c6a47fd83
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  <rguenther@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.
gcc/testsuite/gcc.dg/vect/pr81196-2.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.cc
This page took 0.066968 seconds and 5 git commands to generate.