Certain math libcalls, such as acos and exp, only modify the global variable errno. This automatically adds the globalmemonly attribute to those calls. One use case is in removing unnecessary loads of the call arguments, since the calls will have no side-effects on them.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Is it safe to assume that errno is a "global value" in the LLVM sense? For example, here's how the musl implementation looks like: https://github.com/ifduyue/musl/blob/master/src/errno/__errno_location.c I believe C only requires that errno expands to a thread-local modifiable lvalue, but it does not necessarily have to correspond to a global.
Comment Actions
Can we use a target hook to determine if it is? (errno is not the only use case but a good one).
clang-tidy: error: no member named 'onlyAccessesGlobalMemory' in 'llvm::Function'; did you mean 'onlyAccessesArgMemory'? [clang-diagnostic-error]
not useful