]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/100756 - niter analysis and folding
authorRichard Biener <rguenther@suse.de>
Mon, 24 Oct 2022 07:51:32 +0000 (09:51 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 25 Oct 2022 08:01:19 +0000 (10:01 +0200)
commit19295e8607da2f743368fe6f5708146616aafa91
tree955dc62382f85951dd7c0db7461da0927f1833bf
parent321f89e58510dd5df1b3dbe323344b987a7b11c6
tree-optimization/100756 - niter analysis and folding

niter analysis, specifically the part trying to simplify the computed
maybe_zero condition against the loop header copying condition, is
confused by us now simplifying

  _15 = n_8(D) * 4;
  if (_15 > 0)

to

  _15 = n_8(D) * 4;
  if (n_8(D) > 0)

which is perfectly sound at the point we do this transform.  One
solution might be to involve ranger in this simplification, another
is to be more aggressive when expanding expressions - the condition
we try to simplify is _15 > 0, so all we need is expanding that
to n_8(D) * 4 > 0.

The following does just that.

PR tree-optimization/100756
* tree-ssa-loop-niter.cc (expand_simple_operations): Also
expand multiplications by invariants.

* gcc.dg/vect/pr100756.c: New testcase.
gcc/testsuite/gcc.dg/vect/pr100756.c [new file with mode: 0644]
gcc/tree-ssa-loop-niter.cc