ahatanak added a comment. In http://reviews.llvm.org/D10546#202675, @hfinkel wrote:
> I don't think, however, you can ever mark the inline asm call as 'readnone', > because you have no way of knowing that it does not load anything. Any of its > inputs could be an address, or used to construct an address, to something. > The programmer might also know that the address is always dereferenceable, > and thus won't produce any side effects other than its result (and, thus, not > mark the statement as volatile). The gcc documentation has the following sentence: The "memory" clobber tells the compiler that the assembly code performs memory reads or writes to items other than those listed in the input and output operands (for example, accessing the memory pointed to by one of the input parameters). I took it to mean that you have to add "memory" to an inline-asm statement's clobber list in the case it reads from memory using one of the input registers. If you don't, gcc will treat it as a read-none statement. __asm__ ("movl (%1), %0" : "=r" (res) : "r" (ptr) : "memory"); http://reviews.llvm.org/D10546 _______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits