[Bug other/90381] New test case gcc.dg/tree-ssa/pr88676-2.c fails with its introduction in r270934

helijia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 8 06:34:00 GMT 2019


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

--- Comment #1 from Li Jia He <helijia at gcc dot gnu.org> ---
Thanks for pointing this out.
I used the following code:

struct foo1 {
  int i:1;
};

int test1 (struct foo1 *x)
{
  if (x->i == 0)
    return 1;
  else if (x->i == 1)
    return 1;
  return 0;
}

to dumped the pass output in front of phiopt1
on be machine:

test1 (struct foo1 * x)
{
  unsigned char _1;
  int _3;
  signed char _6;

  <bb 2> :
  _1 = BIT_FIELD_REF <*x_5(D), 8, 0>;
  _6 = (signed char) _1;
  if (_6 >= 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  // predicted unlikely by early return (on trees) predictor.

  <bb 4> :
  # _3 = PHI <1(3), 0(2)>
  return _3;

}

but, on le machine:

test1 (struct foo1 * x)
{
  unsigned char _1;
  unsigned char _2;
  int _3;

  <bb 2> :
  _1 = BIT_FIELD_REF <*x_5(D), 8, 0>;
  _2 = _1 & 1;
  if (_2 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 4>; [INV]

  <bb 3> :
  // predicted unlikely by early return (on trees) predictor.

  <bb 4> :
  # _3 = PHI <1(3), 0(2)>
  return _3;

}
‘’’
The difference is the comparison code in the if statement, however
two_value_replacement will only optimize for EQ_EXPR or NE_EXPR.
Can we limit this test case to the le machine ? Thanks.


More information about the Gcc-bugs mailing list