[PATCH] D112290: [Attributor] Look through indirect calls

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 11:32:27 PDT 2023


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1727
+  if (const Function *Callee = dyn_cast<Function>(CB.getCalledOperand()))
+    return Pred(*Callee, 1);
+
----------------
tianshilei1992 wrote:
> `/*NumCallees=*/ 1`?
will do.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1015
+  for (Function *Callee : Callees)
+    if (!Pred(*Callee, Callees.size() == 1))
+      return false;
----------------
tianshilei1992 wrote:
> jdoerfert wrote:
> > arsenm wrote:
> > > Why the compare to 1 for a bool?
> > If we have more than 1 potential callee we don't know if it is a "must" callee anymore. I haven't thought enough about this to be sure we need or don't need it but there is the possibility we want to distinguish callees that may be called here from the one that certainly is.
> Probably instead of using `NumCallees` (I'm not sure if the CB will need the value), can we use something like `bool IsUnique`?
I figured it doesn't cost anything to provide more information. Once can use it for a heuristic, so decide not to spend time if the #callees is larget han some threshold.


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

https://reviews.llvm.org/D112290



More information about the llvm-commits mailing list