This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/76174] New: Missed loop optimization


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

            Bug ID: 76174
           Summary: Missed loop optimization
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jrmuizel at gmail dot com
  Target Milestone: ---

The call to m is not removed from the following code:

void m();

void l(unsigned int r) {
        unsigned int q = 0;
        unsigned int c = r;
        for (unsigned int x = 0; x<r; x++) {
            if (q == c) {
                m();
                c *= 2;
            }
            q++;
        }
}

if the line 'c *= 2' is removed the optimizer successfully optimizes away the
body of the function.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]