For the avoidance of doubt...

... can *any* instruction(s) other than load and store cause memory reads or writes?

This is pretty important, because I need to be able to track (at least) writes, and ideally also reads in order to be able to make explicit-state model checking work efficiently.

(I don't really care about reads or writes to spilled registers added by the code generator).

Sarah

Sarah Thompson wrote:

... can *any* instruction(s) other than load and store cause memory
reads or writes?

Not that I know of, but some intrinsic functions do.

This is pretty important, because I need to be able to track (at least)
writes, and ideally also reads in order to be able to make
explicit-state model checking work efficiently.

I specifically know that the atomic intrinsic functions I am adding will
write to memory by definition. There may be others that I am not fully
aware of. The LangRef.html has been updated with fairly detailed
information about these intrinsics, but please let me know if there are
unanswered questions.

-Chandler Carruth

Functions calls can (transitively), intrinsics can, and the vaarg instruction can (it updates the pointed to list to point to the next argument).

-Chris

Chris Lattner wrote:

  

... can *any* instruction(s) other than load and store cause memory
reads or writes?
    
Functions calls can (transitively),

This isn't a problem because I'll be picking up those reads and writes as the function executes anyway.

intrinsics can,

Would it be feasible to lower all intrinsics (other than, say, debugging intrinsics) as an opt pass, in a similar way to the intrinsic lowering that was in the non-JITted interpreter? I don't really care too much about the performance hit that this would cause because of the added 'correctness' it would give, if you see what I mean.

and the vaarg instruction can (it updates the pointed to list to point to the next argument).
  

Useful to know. Thanks.

Sarah

Hi Chandler,

I specifically know that the atomic intrinsic functions I am adding will
write to memory by definition. There may be others that I am not fully
aware of. The LangRef.html has been updated with fairly detailed
information about these intrinsics, but please let me know if there are
unanswered questions.
  
Are these new intrinsics subclasses of MemIntrinsic like the existing memmove/memcpy/etc. intrinsics?

[s]

Check out the IntrinsicLowering class. It can lower some of them (e.g. popcount to individual operations, llvm.memset to memset), but it does not lower all of them IIRC. It is used by the C backend and the interpreter implicitly I think.

-Chris