This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix two bugs in gimple-fold.c and/or folding (PR tree-optimization/46909)


I ran into an oddity with one of the testcases.

The one that scans the tree dump (gcc.dg/pr46909.c) fails for pdp11 because the tree dump file says it's checking for != 6 (which should be != 4).  But the generated code is correct.

Also curious is that the tree dump looks very different from the tree dump generated by the same rev compiler (give or take a few hours) on linux-x86.  Any idea what's going on here?

pdp11-aout-gcc tree dump:

;; Function foo (foo)

optimizing two comparisons to x_2(D) != 6
Removing basic block 3
foo (unsigned int x)
{
  int D.1953;

<bb 2>:
  if (x_2(D) != 4)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
Invalid sum of incoming frequencies 7200, should be 2723
  if (x_2(D) != 6)
    goto <bb 6>;
  else
    goto <bb 4>;

<bb 4>:
  if (x_2(D) == 6)
    goto <bb 6>;
  else
    goto <bb 5>;

<bb 5>:

<bb 6>:
Invalid sum of incoming frequencies 5523, should be 10000
  # D.1953_1 = PHI <1(3), -1(5), 1(4)>
  return D.1953_1;

}

linux-x86 treedump:

;; Function foo (foo)

optimizing two comparisons to x_2(D) != 4
Merging blocks 2 and 3
foo (unsigned int x)
{
  int D.1960;
  _Bool D.1959;
  _Bool D.1958;
  _Bool D.1957;
  _Bool D.1955;
  _Bool D.1954;
  _Bool D.1953;

<bb 2>:
  D.1953_3 = x_2(D) != 4;
  D.1954_4 = x_2(D) != 6;
  D.1955_5 = D.1953_3 & D.1954_4;
  D.1957_6 = x_2(D) == 2;
  D.1958_7 = x_2(D) == 6;
  D.1959_8 = D.1957_6 | D.1958_7;
  if (x_2(D) != 4)
    goto <bb 4>;
  else
    goto <bb 3>;

<bb 3>:
Invalid sum of incoming frequencies 400, should be 244

<bb 4>:
Invalid sum of incoming frequencies 9844, should be 10000
  # D.1960_1 = PHI <1(2), -1(3)>
  return D.1960_1;

}

	paul


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