[PATCH] D77817: [llvm][NFC] Replace CallSite with CallBase in Inliner
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 11:56:03 PDT 2020
dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.
Looks good!
================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:949
for (Instruction &I : instructions(N.getFunction()))
- if (auto CS = CallSite(&I))
- if (Function *Callee = CS.getCalledFunction()) {
+ if (auto CS = dyn_cast<CallBase>(&I))
+ if (Function *Callee = CS->getCalledFunction()) {
----------------
Use 'auto *' here, now that CS is a pointer type
================
Comment at: llvm/lib/Transforms/IPO/Inliner.cpp:1157
std::remove_if(Calls.begin() + i + 1, Calls.end(),
- [&Callee](const std::pair<CallSite, int> &Call) {
- return Call.first.getCaller() == &Callee;
+ [&Callee](const std::pair<CallBase *, int> &Call) {
+ return Call.first->getCaller() == &Callee;
----------------
Side note (not related to this patch (saw some other instances while reviewing this too, though) - but might be handy for reference otherwise) - generally for a locally used lambda like this (especially a lambda only used within its expression) I'd encourage using [&] rather than an explicit capture list - like any other nested scope, it should have access to all the enclosing variables implicitly.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77817/new/
https://reviews.llvm.org/D77817
More information about the llvm-commits
mailing list