http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37734
Siarhei Siamashka <siarhei.siamashka at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rearnsha at gcc dot gnu.org --- Comment #3 from Siarhei Siamashka <siarhei.siamashka at gmail dot com> 2010-10-04 23:19:26 UTC --- So if I understand it correctly, there are 2 independent performance issues here: 1. one in the middle-end (redundant comparison with -1) when -O2 optimization is selected. 2. another in ARM target, because it fails to produce efficient code with -Os optimizations, while x86 can. I just remembered that Mozilla has been using -Os optimizations up until now because it was providing the best performance for them: http://gcc.gnu.org/ml/gcc/2010-06/msg00715.html I wonder if this particular missed-optimization issue is contributing to the occasional performance advantage of -Os over -O2 (other than smaller code size and reduced pressure on the instructions cache). Anyway, when looking at any code generated by gcc, simple loops and branches always tend to contain redundant instructions.