Existing constant hoisting pass will merge a group of contants in a small range and hoist the const materialization code to the common dominator of their uses.
However, if the uses are all in cold pathes, we may hoist the materialization code from cold pathes to a hot place. This may hurt performance. The patch simply introduces BFI to the pass and does the hoisting only when the common dominator is colder than the sum of execution freq of all the uses to be merged.
Now usage of BFI is guarded by an option consthoist-with-block-frequency which is off by default. I did the compile time evaluation using spec2006 when the option was on and the compile time increase was in noise range: about 0.5% on averange (ranged from -2% ~ 2% for the 21 C/C++ benchmarks).