[Bug tree-optimization/126941] New: ivopt (and scev) fail for iv's with loop-variant steps

"alfierichards at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.