[PATCH] D100226: Explicitly annotate nofree functions inferred from readonly/readnone

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 9 13:05:38 PDT 2021


reames created this revision.
reames added reviewers: jdoerfert, nlopes, nikic, apilipenko.
Herald added subscribers: dexonsmith, okura, kuter, hiraditya, mcrosier.
Herald added a reviewer: bollu.
reames requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a subscriber: bbn.
Herald added a project: LLVM.

This is somewhat of a style change, but it's one I think is very important.  The results don't change, but the human understandably does.

Without this change, we have situations where function-attrs appears to fail when inferring nofree (as seen by a human reading IR), but that consuming code will see that it doesn't free.  As a human trying to sanity check test results and study IR for optimization possibilities, this is exceeding error prone and confusing.  (I'll note that I wasted several hours just yesterday because of this.)

I also view having the function accessor do inference to be inconsistent with the majority of the code.  We have a couple cases of precidence (e.g. readnone from readonly and mustprogress from will return), but everything else explicitly materializes intermediate results in IR.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100226

Files:
  llvm/include/llvm/IR/Function.h
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Analysis/TypeBasedAliasAnalysis/functionattrs.ll
  llvm/test/Other/cgscc-devirt-iteration.ll
  llvm/test/Other/cgscc-iterate-function-mutation.ll
  llvm/test/Other/cgscc-observe-devirt.ll
  llvm/test/Transforms/FunctionAttrs/2008-09-03-ReadOnly.ll
  llvm/test/Transforms/FunctionAttrs/atomic.ll
  llvm/test/Transforms/FunctionAttrs/incompatible_fn_attrs.ll
  llvm/test/Transforms/FunctionAttrs/nofree-attributor.ll
  llvm/test/Transforms/FunctionAttrs/nofree.ll
  llvm/test/Transforms/FunctionAttrs/nosync.ll
  llvm/test/Transforms/FunctionAttrs/nounwind.ll
  llvm/test/Transforms/FunctionAttrs/optnone.ll
  llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll
  llvm/test/Transforms/Inline/cgscc-update.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100226.336548.patch
Type: text/x-patch
Size: 16006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/c1764914/attachment.bin>


More information about the llvm-commits mailing list