Optionally enabled just like integer and floating point arguments.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Transforms/Utils/SCCPSolver.cpp | ||
---|---|---|
868–869 | This looks not the same with the original statements. For example, we won't do anything if V is the OldArg and ValueState doesn't contain the OldArg. |
llvm/lib/Transforms/Utils/SCCPSolver.cpp | ||
---|---|---|
868–869 | Looking at what handleCallArguments() does, makes me think that OldArg ought to be in either ValueState or StructValueState. That said I am wondering whether it's better to just call Solver.visit(CallSite) for the callsites of specializations right after we've updated them. This would essentially make markArgInFuncSpecialization() obsolete. Lemme try this and run a few tests. |
llvm/lib/Transforms/Utils/SCCPSolver.cpp | ||
---|---|---|
868–869 | Agreed. It looks cleaner at least. |
This is basically the same revision as https://reviews.llvm.org/D145374?id=502612, where markArgInFuncSpecialization was adapted to support struct arguments. As @chill pointed out in D147132, the deprecated function has the potential to be more efficient if funcspec-for-literal-constant gets enabled by default, so I am putting it back in. To answer @ChuanqiXu's comment: arguments we are not specializing on, must be present either in ValueStateor StructValueState therefore the specialization can inherit their lattice value from the original function. The existing code does not handle structs, hence the check I suppose? (a struct won't be present in the standard value map)
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | ||
---|---|---|
678–683 | Maybe delete this part? |
Changes from last revision:
- Renamed markArgInFuncSpecialization to handleSpecializationArguments as a better description.
- Rewrote the above function such that:
- the lattice state of non constant arguments is copied from the original function without recomputing
- the arguments are not pushed to the solver's worklists (there's no need for it)
- Function::arg_iterator is used rather than Argument * directly
- Inlined isValidArgumentType and removed repeated check for int/float types
llvm/lib/Transforms/Utils/SCCPSolver.cpp | ||
---|---|---|
864 | I'll replace this with ValueLatticeElement |
LGTM too, cheers!
llvm/lib/Transforms/Utils/SCCPSolver.cpp | ||
---|---|---|
870 | handleXXX is very uninformative, it might be good in a contexts where we don't know |
Maybe delete this part?