[Bug tree-optimization/32044] [4.3/4.4 Regression] final value replacement too aggressive for e.g. targets with no native div/mod insns
rakdver at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Dec 10 22:56:00 GMT 2008
------- 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
More information about the Gcc-bugs
mailing list