[all-commits] [llvm/llvm-project] 740057: [funcattrs] Infer writeonly argument attribute

Philip Reames via All-commits all-commits at lists.llvm.org
Thu Dec 2 13:05:00 PST 2021

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 740057d185ea0e8b5a4f8b7c78fdf38ae7a66f76
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-12-02 (Thu, 02 Dec 2021)

  Changed paths:
    M clang/test/CodeGen/SystemZ/systemz-inline-asm.c
    M clang/test/CodeGen/aarch64-sve-acle-__ARM_FEATURE_SVE_VECTOR_OPERATORS.c
    M clang/test/CodeGen/arm-vfp16-arguments2.cpp
    M clang/test/CodeGen/mips-vector-return.c
    M clang/test/CodeGen/mips64-nontrivial-return.cpp
    M clang/test/CodeGen/ms-mixed-ptr-sizes.c
    M clang/test/CodeGenOpenCL/amdgpu-abi-struct-coerce.cl
    M clang/test/CodeGenOpenCL/amdgpu-call-kernel.cl
    M clang/test/CodeGenOpenCL/kernels-have-spir-cc-by-default.cl
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    M llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
    M llvm/test/Feature/OperandBundles/pr26510.ll
    M llvm/test/Transforms/Coroutines/coro-async.ll
    M llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
    M llvm/test/Transforms/FunctionAttrs/nocapture.ll
    M llvm/test/Transforms/FunctionAttrs/readattrs.ll
    M llvm/test/Transforms/FunctionAttrs/writeonly.ll

  Log Message:
  [funcattrs] Infer writeonly argument attribute

This change extends the current logic for inferring readonly and readnone argument attributes to also infer writeonly.

This change is deliberately minimal; there's a couple of areas for follow up.
* I left out all call handling and thus any benefit from the SCC walk. When examining the test changes, I realized the existing code is imprecise, and am going to fix that in it's own revision before adding in the writeonly handling. (Mostly because updating the tests is hard when I, the human, can't figure out whether the result is correct.)
* I left out handling for storing a value (as opposed to storing to a pointer). This should benefit readonly/readnone as well, and applies to a bunch of other instructions. Seemed worth having as a separate review.

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

More information about the All-commits mailing list