[PATCH] D114963: [funcattrs] Infer writeonly argument attribute

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 2 08:37:56 PST 2021


reames created this revision.
reames added reviewers: jdoerfert, anna, aeubanks, modimo, sstefan1.
Herald added subscribers: jeroen.dobbelaere, ormris, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

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.

1. 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.)
2. 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D114963

Files:
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
  llvm/test/Feature/OperandBundles/pr26510.ll
  llvm/test/Transforms/Coroutines/coro-async.ll
  llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
  llvm/test/Transforms/FunctionAttrs/nocapture.ll
  llvm/test/Transforms/FunctionAttrs/readattrs.ll
  llvm/test/Transforms/FunctionAttrs/writeonly.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114963.391338.patch
Type: text/x-patch
Size: 11942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211202/634d3aeb/attachment.bin>


More information about the llvm-commits mailing list