Someone pointed out a patch by Zdenek Dvorak which implements TSP-based basic block reordering:
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02335.html to me. From the spec numbers presented, it looks enticing. Zdenek, do you think this is still a reasonable direction to go? If so, I'd like to ping it for review. One thing I don't like about it is that it does static prediction, though, I'd be happy to alter it for dynamic prediction. In my patch: http://gcc.gnu.org/ml/gcc/2011-04/msg00365.html I do handle dynamic prediction (hidden behind the CHEAPER target macro), though, the math is machine independent, once you have the costs and the expected mis-prediction rate. Did I read the numbers right, 4.7% across a fair bit of spec on x86? That seems like a worthwhile type of number, yes?