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

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 10:56:49 PDT 2021


reames added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/FunctionAttrs.cpp:1276
+  if (CB->onlyReadsMemory())
+    return false;
+
----------------
reames wrote:
> nikic wrote:
> > Do I understand right that this is here for declarations that have been annotated as `__attribute___((readonly))`? Rather than handling it here, maybe this should be done in InferFunctionAttrsPass? It currently only handles libcalls, but I think it fits there conceptually.
> I agree with this suggestion, and will reformulate the patch to that effect.
This suggestion is now implemented and ready for review (https://reviews.llvm.org/D100400).

Once that lands, I'll rewrite this patch using the function introduced there.  (We have the same problem for non-declarations when our logic for inference is not equally strong.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100226/new/

https://reviews.llvm.org/D100226



More information about the llvm-commits mailing list