[PATCH] D98884: [IR] Ignore bitcasts of function pointers which are only used as callees in callbase instruction
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 26 10:31:25 PDT 2021
rampitec added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:2149
+ for (User *BU : U->users())
+ SetCallBaseFastCallingConv(BU);
+ continue;
----------------
rampitec wrote:
> madhur13490 wrote:
> > 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.
> >
> > You do not check that user is a callee.
>
> And the original code does not check it either. This also warrants a test.
You now have it in 3 different places, so it may make sense. It would look better if you combine conditions like '!CB || !CB->isCallee(&U))' and also 'isSomething' function shall return bool, not a pointer.
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