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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think at -O1 in *.sra it is still correct, we have
  <bb 2> [local count: 118111600]:
  a.0_12 = a;
  b.1_13 = b;
  _14 = a.0_12 + b.1_13;
  _15 = _14 + 2147483647;
  c = _15;
  if (_15 <= 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 3> [local count: 955630224]:
  # _18 = PHI <_3(3), _14(2)>
  _5 = _18 - -2147483648;
  a = _5;
  a.0_1 = a;
  b.1_2 = b;
  _3 = a.0_1 + b.1_2;
  _4 = _3 + 2147483647;
  c = _4;
  if (_4 <= 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 4>; [11.00%]

  <bb 4> [local count: 118111600]:
  # a.0_17 = PHI <a.0_1(3), a.0_12(2)>
  if (a.0_17 != 1)
    goto <bb 5>; [0.00%]
  else
    goto <bb 6>; [100.00%]

  <bb 5> [count: 0]:
  # USE = nonlocal escaped
  # CLB = nonlocal escaped
  __builtin_abort ();

  <bb 6> [local count: 118111600]:
  return 0;
where _14 for non-UB should be [-INF, 0] (it is -__INT_MAX__, so ok),
and in bb3 from that edge because _15 <= 0 it implies _14 is in [-INF,
-INT_MAX].
For that _5 has [0, 1] range.  For _4 <= 0 the same applies for _3.
So the ranges from dom2 look reasonable to me:
Global Exported: _4 = [irange] int [-1, +INF]
Global Exported: _5 = [irange] int [0, 1] MASK 0x80000001 VALUE 0x0
Global Exported: _15 = [irange] int [-1, +INF]
Global Exported: _18 = [irange] int [-INF, -2147483647]

Reply via email to