Noticed that the computation for function specialization cost of a function wouldn't change during the traversal of the arguments for the function. We could hoist the computation out of the traversal. I observed about ~1% improvement on compile time for spec2017. But I guess it may not be precise. This should be NFC and fine.
Test Plan: check-all, spec2017 int rate