------- Comment #66 from rakdver at gcc dot gnu dot org 2008-12-12 20:42 ------- (In reply to comment #64) > I agree that the most practical short-term solution is to avoid transforming > the loop into a division. > > However, I'm also interested in what we think the right long-term solution > is. > I'm not convinced that our goal should be to preserve the form used by the > user; rather, I'm inclined to say that our goal should be to (a) recognize the > loop as division, and, (b) generate loops to implement division when > profitable. It's reasonable is to say that the form user by the user > influences the decision about profitability made in (b).
Agreed; there are also other parts of tree->rtl expansion that could benefit from using the information about the distribution of the inputs, whether obtained from value profiling, VRP, scev analysis, guesses based on the structure of the program (as in this case), or possibly hints by the user (builtin_expect). I do not have time to work on that now, though (I think it would make a rather nice gsoc project, or a student project in general). -- rakdver at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|rakdver at gcc dot gnu dot |unassigned at gcc dot gnu |org |dot org Status|ASSIGNED |NEW http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044