[PATCH] D71617: [WIP][NFC][Attributor] noalias attribute deduction fixme

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 27 13:33:34 PST 2019


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2311
+            if (!Arg->hasNoCaptureAttr()) {
+              return true;
+            }
----------------
If you want to use the `AANoCapture` you need the IR position of the use: `const IRPosition UseIRP = IRPosition::callsite_argument(CS, CS.getArgumentNo(&U));` not of the outer call site.  If you just want to know if it already is marked `nocapture` you can just ask the call site `CS`: `CS.paramHasAttr(CS.getArgumentNo(&U), Attribute::NoCapture)`

You also want to return `true` (= all is OK) if the argument has a no-capture attribute. If not, you continue with the reachability check we need before `// Unknown user for which we can not track uses further`.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2332
+      // Check if V's uses reach getCtxI() i.e. callSite.
+      if (!A.checkForAllUses(UsePred, *this, V, getCtxI())) {
+        LLVM_DEBUG(
----------------
You need to iterate over all uses (not only reachable ones) and then in the `UsePred` ask if `getCtxI()` is reachable from the User. If not, the `UsePred` can return `true` (=all is OK).


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:5063
+                                          IRPosition::function(*ScopeFn),
+                                          /* TrackDependence */ false)
+              : nullptr;
----------------
You need to track dependence here or remember if you excluded a use due to reachability and track the dependence then. For liveness we doe this with the `AnyDead` flag.


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

https://reviews.llvm.org/D71617





More information about the llvm-commits mailing list