tree-optimization/104519 - adjust PR100499 niter fix
authorRichard Biener <rguenther@suse.de>
Tue, 15 Feb 2022 08:40:59 +0000 (09:40 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 15 Feb 2022 10:41:42 +0000 (11:41 +0100)
commitd8b6da8dd15240849e00d46f3aef40cb8eeb1dc5
treeb52cc3fed9af2204bd2b9ba931c73f610cf9499f
parentc4c0aa60891daeb4ea5a7c265bd681038f6d8271
tree-optimization/104519 - adjust PR100499 niter fix

The following adjusts the PR100499 niter fix to use the appropriate
types when checking whether the difference between the final and base
values of the IV are a multiple of the step.  It also gets rid of
an always false condition in multiple_of_p which lead me to a
wrong solution first.

2022-02-15  Richard Biener  <rguenther@suse.de>

PR tree-optimization/104519
* fold-const.cc (multiple_of_p): Remove never true condition.
* tree-ssa-loop-niter.cc (number_of_iterations_ne): Use
the appropriate types for determining whether the difference
of final and base is a multiple of the step.

* gcc.dg/torture/pr104519.c: New testcase.
gcc/fold-const.cc
gcc/testsuite/gcc.dg/torture/pr104519.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.cc