[PATCH] D98884: [IR] Ignore bitcasts of function pointers which are only used as callees in callbase instruction

Madhur Amilkanthwar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 10:26:04 PDT 2021


madhur13490 added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:2149
+      for (User *BU : U->users())
+        SetCallBaseFastCallingConv(BU);
+      continue;
----------------
rampitec wrote:
> You do not check that user is a callee.
> You do not check that user is a callee.

Done. I think we can introduce a utility function ``CallBase* isCallBaseCallee(Use &U)`` which can outline the below checks

```

 User *UU = U.getUser();
  CallBase *CB = dyn_cast<CallBase>(UU);
  if (!CB)
    return nullptr;
  if (!CB->isCallee(&U))
    return nullptr;
  return CB

```

Not sure if this is an overkill. 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98884



More information about the llvm-commits mailing list