[all-commits] [llvm/llvm-project] 0b0931: [funcattrs] Infer writeonly argument attribute [pa...

Philip Reames via All-commits all-commits at lists.llvm.org
Tue Jan 4 09:08:10 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b09313cd53316eacbdc5e98d4ef00bef2c41d02
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2022-01-04 (Tue, 04 Jan 2022)

  Changed paths:
    M clang/test/CodeGen/arm-vfp16-arguments.c
    M clang/test/CodeGenCXX/wasm-args-returns.cpp
    M clang/test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    M llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
    M llvm/test/Other/cgscc-devirt-iteration.ll
    M llvm/test/Transforms/FunctionAttrs/norecurse.ll
    M llvm/test/Transforms/FunctionAttrs/writeonly.ll

  Log Message:
  [funcattrs] Infer writeonly argument attribute [part 2]

This builds on the code from D114963, and extends it to handle calls both direct and indirect. With the revised code structure (from series of previously landed NFCs), this is pretty straight forward.

One thing to note is that we can not infer writeonly for arguments which might be captured. If the pointer can be read back by the caller, and then read through, we have no way to track that. This is the same restriction we have for readonly, except that we get no mileage out of the "callee can be readonly" exception since a writeonly param on a readonly function is either a) readnone or b) UB. This means we can't actually infer much unless nocapture has already been inferred.

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

More information about the All-commits mailing list