------- Comment #9 from amylaar at gcc dot gnu dot org 2009-01-14 18:47 ------- I think the disregard for conditional execution opportunities and the assumption that phi nodes have no execution cost are two separate issues. I'd like to address the latter first, because it causes exponential code and execution time growth.
A phi node joining two constants has at least the cost of a constant load. A phi node joining two different variables which are initialized by a graph with constant leafs costs at least a reg-reg copy on one arm, plus the cost of its parents if these are needed solely for this phi node. Therefore, if an expression is only partially anticipatable, we should compare the cost of any phi node needed to compute it early with the estimated likelyhod that such a computatatio, once done, is actually needed, multiplied with the cost of the replaced operation. Can we use edge probabilities inside tree-pre to calculate execution probabilities? Can we calculate the cost of replaced expressions? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38785