[llvm-dev] [RFC] Adding a globalmemonly attribute for functions that only access global memory

Johannes Doerfert via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 14 11:53:29 PDT 2021


On 9/14/21 1:27 PM, James Y Knight wrote:
> On Tue, Sep 14, 2021 at 2:03 PM Philip Reames via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> In fact, the original motivation for the globalmemonly proposal could be
>> alternatively solved with:
>>
>> @errno = external global i32
>>
>> declare void @mathfunc(float, float) globalmayalias(@errno)
>
> How would that work, since errno generally isn't a global (or a
> compiler-supported thread-local)? It's typically something along the lines
> of:
>    int* __errno_location(void) __attribute__((const));
>    #define errno *__errno_location()
>
Technically, we can make up locations as long as we are consistent.





More information about the llvm-dev mailing list