This is the successive patch of D105966. With D105544, D105966 and this diff, they construct my prototype of ThinLTO for function specialization.
To make this work for 505.mcf_r, it requires that the function specialization handle the case that the argument is already constant, which would be handled by IPSCCP by the design of function specialization. We could discuss it later.