Factored out part of https://reviews.llvm.org/D119880 as requested on the review.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks like a good refactoring, but needs a clang-format, and have added one question inline.
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
462–463 | Was wondering if we could change SpecializationList to: SmallVector<std::unique_ptr<SpecializationInfo>>; so that we move and transfer ownership instead of copying things here. |
llvm/include/llvm/Transforms/Utils/SCCPSolver.h | ||
---|---|---|
154–160 | Does the function modify Arg? If not, please either pass by value or as const reference. |
llvm/include/llvm/Transforms/Utils/SCCPSolver.h | ||
---|---|---|
154–160 | Will do, thanks. | |
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
462–463 | Good remark, but will there really be a copy? I thought that the Return Value Optimization (copy elision) prevents that. Alternatively I could make the function void and pass the SpecializationList by reference on the argument list. |
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
462–463 | My understanding is that this is an optimisation that may or may not be implemented. Looks like to be specified for c++17 though, but since we are using C++14 being explicit might be better. |
Changes from last revision:
- marked ArgInfo as const reference when passed to markArgInFuncSpecialization() and rewriteCallSites()
- passed SpecializationList by reference to calculateGains() instead of returning by value
- removed the IsPartial flag from isArgumentInteresting() and getPossibleConstants() as it's no longer used anywhere in the code
- clang-formatted the code
Does the function modify Arg? If not, please either pass by value or as const reference.