[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
Mon Mar 29 08:30:53 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;
----------------
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 ...
}
```


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