We should be able to implement it as a triple. We should first note that program specialization is not a monolithic operation. That is, we transform as long as the program runs faster. As for what data to specialize on, we can use all of our sources of information. There is a continuum of information available as a program runs.
Later information is more accurate but also more expensive to collect.
We can perform both code and data profiling. Code profiling shows which pieces of code execute most often and thus deserve the most attention via program transformation. Data profiling tells us which data values appear most often. These may be used for specialization. There are undoubtedly others, both orthogonal and non-orthogonal.