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

--- Comment #6 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Alright, so after some digging through the dumps I realised that adding
-fno-early-inlining is enough to get a non-LTO testcase.  So the following
testcase reproduces the different codegen before/after the above commit with
just -Ofast -fno-early-inlining (no LTO required):

long g_y, MorphologyApply_changed, g_v;
int g_kernel, MorphologyApply_work_image, g_t, g_img, MorphologyApply_verbose,
    gapcn_t1, gapcn_cache_info_0;
typedef short Quantum;
double MorphologyPrimitive_bias, g_k, g_r2, g_r1;
Quantum g_r0;
int *gapcn_cache_info;
void *gapcn_image_0;
int *GetAuthenticPixelCacheNexus();
int *GetCacheViewAuthenticPixels() { return GetAuthenticPixelCacheNexus(); }
void ThrowMagickException();
int *GetAuthenticPixelCacheNexus() {
  gapcn_cache_info = gapcn_image_0;
  if (gapcn_cache_info_0 || 0 >= (long)gapcn_image_0)
    ThrowMagickException();
  return &gapcn_t1;
}
typedef struct {
  Quantum blue, green, red, opacity;
} PixelPacket;
PixelPacket *MorphologyPrimitive_p;
long MorphologyPrimitive(int channel) {
  GetCacheViewAuthenticPixels();
  for (; g_y < g_img; g_y++) {
    double result_0 = MorphologyPrimitive_bias;
    if (channel == 0)
      for (g_v = 0; g_v < g_kernel; g_v++) {
        result_0 += g_k * MorphologyPrimitive_p->red;
        g_r1 += g_k * MorphologyPrimitive_p->green;
        g_r2 += g_k * MorphologyPrimitive_p->blue;
        MorphologyPrimitive_p++;
      }
    g_r0 = result_0;
  }
  return 0;
}
int *MorphologyImage() {
  while (MorphologyApply_changed) {
    if (MorphologyApply_work_image)
      goto error_cleanup;
    MorphologyPrimitive(0);
    if (MorphologyApply_verbose)
      ThrowMagickException();
  }
  goto exit_cleanup;
error_cleanup:
exit_cleanup:
  return &g_t;
}

Reply via email to