[PATCH] D67886: NoFree argument attribute.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 10:06:47 PDT 2019


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

Small nits. Otherwise LGTM.
Also, make sure we have a test with 2 pointer arguments, one freed, one no-free annotated.



================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1421
+    const auto &NoFreeAA =
+        A.getAAFor<AANoFree>(*this, IRPosition::function(*F));
+    if (NoFreeAA.isAssumedNoFree())
----------------
Replace `IRPosition::function(*F))` with `IRPosition::function_scope(IRP)`.
`IRP` is `getIRPosition()`. That should remove the need to look at the call site explicitly below. 




================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1442
+      const AAIsDead &LivenessAA =
+          A.getAAFor<AAIsDead>(*this, IRPosition::function(*F));
+
----------------
Hoist this out of the loop


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1457
+        if (NoFreeFunc.isAssumedNoFree())
+          continue;
+
----------------
I don't think this is necessary but fine with me. (should be implied and checked by the call site argument attr).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D67886





More information about the llvm-commits mailing list