-
Notifications
You must be signed in to change notification settings - Fork 15k
Description
The LLVM IR has a memory attribute, which allows specifying memory access for different regions. Specifically, all memory, memory passed via arguments and inaccessible memory. All of these fields can be specified to have (1) no access, (2) read only access, (3) write only access or (4) read/write access. Combining these is also possible. That way it is possible to specify that a function can read/write global memory, but only read argument memory. That allows for really nice optimizations like removing dead calls to functions that only write to some memory (e.g. the frexp family of functions). It would be great if clang could expose this flexibility via an attribute. (Except maybe the inaccessible memory part, since that doesn't really seem like a useful concept outside of builtins)