[llvm-dev] invariant.load metadata semantics

Michael Kuperstein via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 25 17:31:52 PDT 2016


>
> Yes, that is what I had in mind.  Moreover, in
>
> func()
> {
>   int k = load a, invariant.load !1
>   print(k);
>   store a, 5
> }
>
> k can be optimized to 5, in a form of "time traveling store
> forwarding" :).  The store (at least if non-atomic and non-volatile)
> is also trivially dead.
>
>
Only if we know that print() returns, right?

Otherwise, we have the usual trouble with things like:
void print(int i) {
  if (k != 5) abort();
  ...
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160825/51feeb96/attachment.html>


More information about the llvm-dev mailing list