[PATCH] D76175: [Attributor][NFC] Typos in doc

Stefan Stipanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 03:43:33 PDT 2020


sstefan1 accepted this revision.
sstefan1 added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:280
            "Invalid position does not have an anchor scope!");
-    Value &V = getAnchorValue();
-    if (isa<Function>(V))
-      return &cast<Function>(V);
-    if (isa<Argument>(V))
-      return cast<Argument>(V).getParent();
-    if (isa<Instruction>(V))
-      return cast<Instruction>(V).getFunction();
-    return nullptr;
+    return getAnchorScope();
   }
----------------
jdoerfert wrote:
> baziotis wrote:
> > sstefan1 wrote:
> > > This makes sense. Now that I look at the other parts we seem to mix these two a lot. I think the better solution is to inline `getAnchorScope` here and replace all the call sites with `getAssociatedFunction` as it's clearer (at least to me). 
> > Yes, I like that too.
> These are different things for call site [arguments]
I agree, my bad. I think that there are at least few places that we use `getAssociatedFunction` instead of `getAnchorScope`. Not necessary in this patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76175





More information about the llvm-commits mailing list