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

            Bug ID: 91633
           Summary: Why -funroll-loops affect code without loop.
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: crazylht at gmail dot com
                CC: hjl.tools at gmail dot com, skpgkp2 at gmail dot com
  Target Milestone: ---
            Target: i386, x86-64

This testcase is cut from 538.exchange_r in SPEC2017.
---
typedef struct pixel{
  float red;
  float green;
  float blue;
}pixel;

typedef struct pixel2{
  unsigned short red;
  unsigned short green;
  unsigned short blue;
}pixel2;

extern double* p;
int foo (pixel* a, pixel2* b)
{
  double ret = (a->red-b->red) * (a->red-b->red)
    + (a->green-b->green) * (a->green-b->green)
    + (a->blue-b->blue) * (a->blue-b->blue);
  if (ret <= *p)
    return 1;
  return 0;
}
---

It is supposed -funroll-loops wouldn't affect code generation, but currently
it's not, refer to https://godbolt.org/z/6hvQC7.

What i got in function process_options in toplev.c:
----
if (flag_rename_registers == AUTODETECT_VALUE)
    flag_rename_registers = flag_unroll_loops;
----

Also note  pass rnreg will affect sched2.

Reply via email to