[PATCH] D98884: [IR] Ignore bitcasts of function pointers which are only used as callees in callbase instruction
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 30 02:15:43 PDT 2021
foad added inline comments.
================
Comment at: llvm/lib/IR/Function.cpp:1630
+ if (const CallBase *CB = dyn_cast<CallBase>(U.getUser()))
+ return CB->isCallee(&U);
+ return false;
----------------
rampitec wrote:
> foad wrote:
> > This does not respect IgnoreCallbackUses, IgnoreAssumeLikeCalls, IgnoreLLVMUsed. Also it does not handle bitcasts-of-bitcasts.
> >
> > Wouldn't the whole function be better implemented as a worklist algorithm now?
> > ```
> > SmallVector<Use &> WorkList(use_begin(), use_end());
> > while (!WorkList.empty()) {
> > U = WorkList.pop_back_val();
> > if (isa<BitCast>(U))
> > WorkList.push_back(U.use_begin(), U.use_end());
> > else if (isa<CallBase>(U))
> > ... all the existing logic that handles Ignore* flags ...
> > }
> > ```
> In general yes, but this patch is growing. This would be a good followup change.
> The pass calls hasAddressTaken() without arguments so that is not exerciseable here as is. For the same reason I withdraw my request to split the patch. Also note this may change if this is landed: D96179.
I disagree. You're changing a core API Function::hasAddressTaken in a way that could change the behaviour for all existing callers, whether they like it or not. So I think this part probably should be a separate patch and the implementation should be as rigorous as possible.
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