[llvm-dev] invariant.load metadata semantics

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 25 13:49:36 PDT 2016

On Thu, Aug 25, 2016 at 1:46 PM, Caldarale, Charles R via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of
> Hal Finkel via llvm-dev
> > Subject: Re: [llvm-dev] invariant.load metadata semantics
> > Alternatively, we might phrase this as: The optimizer may assume that
> all values loaded
> > from a location, where any of the loads are tagged with !invariant.load,
> are identical.
> This would seem to limit the usefulness of the invariant attribute.  I
> would expect invariant to indicate that loads reachable from the one marked
> invariant are guaranteed to read the same value, but that prior ones are
> not.

Define "reachable".

Do you mean there is any path from the load to the new load?

If so, what about loop backedges?


This is one of the reasons they are explicitly marked.

> This would allow updates to be made to the location of interest up to the
> point of declared invariance, but not after.

This has the same problem.

for loop:

  store a
  load a !invariant.load

Legal or not if we can prove the loop iterates >1 time?
What does it mean?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160825/cdf3c492/attachment.html>

More information about the llvm-dev mailing list