------- Comment #16 from rakdver at gcc dot gnu dot org 2007-06-17 06:38 ------- (In reply to comment #12) > So this is now an enhancement request for sccp to honor loop roll count or > basic-block frequency and cost of the replacement.
we used to take the cost of the replacement into account. It caused so many missed-optimization PRs that I decided to just disable it. The main problem is that while theoretically you can determine whether replacement is more costly then performing the computation in the loop (although even this is nontrivial in practice), it is very difficult to estimate the gains of enabling further optimizations. One possible solution would be to annotate the division by the expected value of the result. Division expanders then may decide whether to expand to machine instruction/libcall or to check for small values of the result in if-guards first. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044