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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
With the __builtin_unreachable present (thus g >= 0) we simplify
(int)(char)d to d & 255 which causes the VN difference:

 Value numbering stmt = _9 = (int) _8;
+d.4_7 is available for d.4_7
+_2 is available for _2
 Setting value number of _9 to _9 (changed)
-Making available beyond BB2 _9 for value _9
-Value numbering stmt = _10 = (int) d.4_7;
-Setting value number of _10 to _9 (changed)
+Making available beyond BB4 _9 for value _9
+Value numbering stmt = _10 = b.3_6 & 255;
+_2 is available for _2
+Setting value number of _10 to _10 (changed)
+Making available beyond BB4 _10 for value _10
 Value numbering stmt = _11 = _9 % _10;

in particular we have

  _2 = b;
  b.3_6 = b;
  d.4_7 = (char) b.3_6;
  _8 = (char) _2;
  _9 = (int) _8;
  _10 = (int) d.4_7;
  _11 = _9 % _10;

vs.

  _2 = b;
  b.3_6 = b;
  d.4_7 = (char) b.3_6;
  _8 = (char) _2;
  if (d.4_7 <= 0)
    goto <bb 3>; [0.00%]
  else
    goto <bb 4>; [100.00%]

  <bb 3> [count: 0]:
  __builtin_unreachable ();

  <bb 4> [local count: 1073741824]:
  _9 = (int) _8;
  _10 = b.3_6 & 255;
  _11 = _9 % _10;

where the trivial equivalence is no longer visible.

Reply via email to