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

--- Comment #28 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue with the patch is that it does speculation for expressions that might
invoke undefined behavior.  Like for gcc.c-torture/execute/20000801-2.c where
it speculates a load from the next-next iteration:

  <bb 2>:
  a.next = &b;
  b.next = 0B;

  <bb 3>:
  # node_9 = PHI <prephitmp_4(4), &a(2)>
  # prephitmp_4 = PHI <prephitmp_10(4), &b(2)>
  # prephitmp_10 = PHI <pretmp_7(4), 0B(2)>
  if (prephitmp_4 != 0B)
    goto <bb 4>;
  else
    goto <bb 5>;

  <bb 4>:
  pretmp_7 = prephitmp_10->next;
  goto <bb 3>;

similar issues can appear for non-backedges, too, and for example undefined
integer overflow.  We'd need to be much more careful with what we'd insert
here.

Reply via email to