[Bug tree-optimization/100846] Different vector handling for strided IVs and modulo conditions

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 1 08:12:55 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100846

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think that this is iteration space splitting, turning the loop into

   for (int i = 0; i < 100; i+=2)
    if (1)
      x[i] += 1;
   for (int i = 1; i < 100; i+=2)
    if (0)
      x[i] += 1;

alternatively it is unrolling driven by jump threading.  That said,
we'd likely want to handle

  for (int i = 0; i < 100; ++i)
    if ((i & 1) == 0)
      x[i] += 1;
    else
      y[i] += 1;

as well.  loop distribution would eventually create two of the original
loops out of that.

I think the most promising way is to do unrolling and have that keyed on
the ability to optimize away the branches.  So yes, it's ivcanon, but not
said pass but the implementation file.


More information about the Gcc-bugs mailing list