[all-commits] [llvm/llvm-project] ea75be: [InferAttrs] Add writeonly to all the math functions

Benjamin Kramer via All-commits all-commits at lists.llvm.org
Tue Jan 4 07:59:00 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ea75be3d9df448b6abafaf752a8141764d93ca33
      https://github.com/llvm/llvm-project/commit/ea75be3d9df448b6abafaf752a8141764d93ca33
  Author: Benjamin Kramer <benny.kra at googlemail.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M llvm/lib/Transforms/Utils/BuildLibCalls.cpp
    M llvm/test/Transforms/InferFunctionAttrs/annotate.ll

  Log Message:
  -----------
  [InferAttrs] Add writeonly to all the math functions

All of these functions would be `readnone`, but can't be on platforms
where they can set `errno`. A `writeonly` function with no pointer
arguments can only write (but never read) global state.

Writeonly theoretically allows these calls to be CSE'd (a writeonly call
with the same arguments will always result in the same global stores) or
hoisted out of loops, but that's not implemented currently.

There are a few functions in this list that could be `readnone` instead
of `writeonly`, if someone is interested.

Differential Revision: https://reviews.llvm.org/D116426




More information about the All-commits mailing list