The second patch in this series extends the niter analysis to support
loop exit compares with IORs. The first patch remains the same as
the one submitted earlier.
There is a possibility of merging the code of both first and second
patches by using only one function. However, due to some differences
in the handling of the leaf cases, it is kept as a separate function
for now for easiness of review and can be updated in the next series
if suggested. Also, unlike the AND case, IOR case needs
to find the MIN of all intermediate compares and store that in the
niter, rather than keeping the niter of one of the compares. That
introduced slight complication in keeping the code clean without
a separate function.
Merging the functions to one might help in dealing with a mixed
pattern too - like (a | b) & c. But not sure we will ever have real
cases like that. Please suggest.
Raghesh Aloor (2):
tree-optimization/127510 - count a loop exit that combines several
compares
tree-optimization/127510 - count a loop exit that combines compares
with IOR
gcc/testsuite/gcc.dg/tree-ssa/pr127510-1.c | 24 ++
gcc/testsuite/gcc.dg/tree-ssa/pr127510-2.c | 29 +++
gcc/testsuite/gcc.dg/tree-ssa/pr127510-3.c | 27 ++
gcc/tree-ssa-loop-niter.cc | 289 ++++++++++++++++++++-
4 files changed, 367 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr127510-1.c
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr127510-2.c
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr127510-3.c
--
2.53.0