This patch adds an another analysis pass which is similar to FunctionPropertiesAnalysis to get more function features like
numbers of instructions, basic blocks, and so on.
Details
Diff Detail
Event Timeline
@jdoerfert @mtrofin
Currently, I created a new pass because I'm not sure additional costs to calculates new features are affordable at MLInliner.
I'd like to put new features on FunctionPropertiesInfo if computational costs don't matter.
We could always make it an argument for the pass, e.g., when you create it you select the precision. Or, a command line option to get higher/lower precision. I think by default it should track all features and we can have subsets defined in a command line option if necessary. So if a user wants only 10 of the 40 features they add a selector into a command line enum and use it to skip features.
Wdyt?
We could always make it an argument for the pass, e.g., when you create it you select the precision. Or, a command line option to get higher/lower precision. I think by default it should track all features and we can have subsets defined in a command line option if necessary. So if a user wants only 10 of the 40 features they add a selector into a command line enum and use it to skip features.
Creating an argument for the pass sounds good for me. IMHO, we don't need command option for the pass because I guess all use cases are from LLVM internal.
We could always make it an argument for the pass, e.g., when you create it you select the precision. Or, a command line option to get higher/lower precision. I think by default it should track all features and we can have subsets defined in a command line option if necessary. So if a user wants only 10 of the 40 features they add a selector into a command line enum and use it to skip features.
On the second thought, I think it is better to separate the pass.
Currently, FunctionPropertiesInfo is specialized for MLInliner and intended to be used practically.
We might want DetailedFunctionPropertiesInfo to be very rich analayzer which do not much care about the runtime cost.
Users can use the features of DetailedFunctionPropertiesInfo in experimentally until they find the essential features for their applications.
Wdyt?
llvm/include/llvm/Analysis/FunctionPropertiesAnalysis.h | ||
---|---|---|
92 | does the visitor need to be public? | |
llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp | ||
143 | make 500 a flag (it's arbitrary otherwise. well... it's arbitrary after that, too, but at least it's user-controllable.). same with 15 below | |
156 | style: capitalize variables. since you have an "I", maybe s/i/OpIdx | |
171 | unsigned LoopDepth |
@uenoku I'm interested in getting this patch into upstream LLVM and addressing the other reviewer comments. Do you mind if I commandeer this revision and tag you as a co-author on the eventual commit?
I talked with @mtrofin briefly (only covering flags/separate pass), and the plan is as follows
- address remaining inline comments
- Refactor DetailedFunctionPropertiesAnalysis into FunctionPropertiesAnalysis and keep the additional options behind a command line flag. I would like to use actual pass options here similar to how passes like instcombine can take in arguments, but the new pass manager doesn't seem to currently have support for analysis passes with parameters like is present for traditional function passes. I'm not sure how difficult it would be to get this implemented, but it doesn't look trivial.
- Address additional comments, land the patch.
Nit: Is it "Precise" or "Detailed"?