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

            Bug ID: 126941
           Summary: ivopt (and scev) fail for iv's with loop-variant steps
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alfierichards at gcc dot gnu.org
  Target Milestone: ---

For a case such as

> int bad_addressing (char *arr1, unsigned long n) {
>     for (unsigned long i = 0; i < n;) {
>        unsigned long advance = (*arr1 == 2) ? 4 : 7;
>        arr1 += advance;
>        i += advance;
>     }
> }

The two IV's (arr1 and i) are not optimized by ivopts.

This is because scev cannot handle a loop variant step.
  • [Bug tree-optimization/12694... alfierichards at gcc dot gnu.org via Gcc-bugs

Reply via email to