[llvm-dev] invariant.load metadata semantics

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 25 14:01:05 PDT 2016

Hi Hal,

Hal Finkel via llvm-dev wrote:
 > 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.

I'm okay if we s/any of the loads/any of the loads that execute at
runtime/.  Otherwise we end up in the same "dead code changes
semantics" soup.

 > This has the benefit of covering the fact that no outside entity (i.e.
 > the operating system) changes the value, and that we can change it, but
 > only to the same value it had before (if we'll later be able to observe
 > the difference).

Not sure if we gain much b allowing "changing it to the same value"
(except perhaps "invariant_load(ptr); *ptr = 40" is not provably UB),
but I don't mind it either.

-- Sanjoy

More information about the llvm-dev mailing list