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

            Bug ID: 118688
           Summary: patch splitting should happen when it is known only
                    path is hot
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
                CC: dhruvc at nvidia dot com, pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Take:
```
#define iterations 100000
#define LEN_1D 32000
#define LEN_2D 256
#define ARRAY_ALIGNMENT 64
#include <sys/time.h>

struct args_t
{
  struct timeval t1;
  struct timeval t2;
  void *__restrict__ arg_info;
};

typedef float real_t;

__attribute__ ((aligned (ARRAY_ALIGNMENT))) real_t a[LEN_1D], b[LEN_1D],
  c[LEN_1D], d[LEN_1D], e[LEN_1D], aa[LEN_2D][LEN_2D];

void
s258 (struct args_t *func_args)
{
  real_t s;
  for (int nl = 0; nl < iterations; nl++)
    {
      s = 0.;
      for (int i = 0; i < LEN_2D; ++i)
        {
          if (a[i] > 0.)
            {
              [[likely]];
              s = d[i] * d[i];
            }
          b[i] = s * c[i] + d[i];
          e[i] = (s + (real_t) 1.) * aa[0][i];
        }
    }
}
```

poor_ifcvt_pred should not be taken into account in the above case and GCC
should split the path as we know one path is hotter than the other. This will
fix what was noticed in PR 118505 with PGO enabled :).

Reply via email to