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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
maybe represent this in a more formal way:

  node = __builtin_speculate (node + 1, node->next);

and in GIMPLE:

  _1 = node + 1;
  _2 = node->next;
  node = .SPECULATE (_1, _2);

and during RTL expansion leave the desired representation to the targets
which could use an UNSPEC to avoid optimizing it away.

Formally we'd say __builtin_speculate "uses" the first argument if its
value is equal to the second argument value.

That said, I heard CPUs have prefetchers that recognize this kind of list
walking.  I wonder why they wouldn't then also be able to speculate the
load value like you say.

Oh, and doesn't this explicit speculation of using node++ open up spectre
style attacks?

Reply via email to