[llvm-dev] @llvm.memcpy not honoring volatile?

JF Bastien via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 7 10:48:29 PDT 2019



> On Jun 5, 2019, at 2:28 PM, Tim Northover via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> On Wed, 5 Jun 2019 at 13:49, Eli Friedman via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>> I don’t see any particular reason to guarantee that a volatile memcpy will access each byte exactly once.  How is that useful?
> 
> I agree it's probably not that useful, but I think the non-duplicating
> property of volatile is ingrained strongly enough that viewing a
> memcpy as a single load and store to each unit (in an unspecified
> order) should be legitimate; so I think this actually is a bug.
> 
> As the documentation says though, it's unwise to depend on the
> behaviour of a volatile memcpy.

I agree with Tim, this seems like a bug. My expectation is that volatile touch each memory location exactly once, unless absolutely impossible (e.g. bitfields on most ISAs).


More information about the llvm-dev mailing list