------- Comment #58 from rakdver at gcc dot gnu dot org 2008-12-10 22:55 ------- (In reply to comment #56) > Re. comment #52: > > I've pasted the test case in the audit trail here as plain text -- it's pretty > small and it shows the problem nicely. The issue is that with -Os, on all > targets, the line, > > propsRes->lc = prop0; > > is replaced with: > > propsRes->lc = (int) (int) (prop0.24 % 45); // with prop0.24 = propsData[0]; > > so there is no div/mod instruction in the original code, but one appears as a > result of the final value replacement optimization. With -O2 there is also a > div instruction, but I am not sure where it comes from (I suspect loop header > copying, but it's inconsequential for this issue anyway).
actually, the div instruction also comes from the final value replacement. We eliminate the loop completely and replace it with the following: D.1286 = prop0 + 211; prop0 = D.1286 % 45; propsRes->pb = [plus_expr] (propsRes->pb + 1) + (int) (D.1286 / 45); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044