Hi, The attached patch disables rtl loop invariant when optimizing for code size. Committed to ARM/Embedded-4_8-branch as r202067.
Thanks. bin 2013-08-29 Zhenqiang Chen <zhenqiang.c...@arm.com> * config/arm/arm.c (arm_option_override): Disable loop2_invariant pass when optimize_size and ira-loop-pressure is not enabled.
Index: gcc/ChangeLog.arm =================================================================== --- gcc/ChangeLog.arm (revision 202066) +++ gcc/ChangeLog.arm (revision 202067) @@ -1,3 +1,8 @@ +2013-08-29 Zhenqiang Chen <zhenqiang.c...@arm.com> + + * config/arm/arm.c (arm_option_override): Disable loop2_invariant + pass when optimize_size and ira-loop-pressure is not enabled. + 2013-08-05 Terry Guo <terry....@arm.com> Backport from mainline r197956 Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 202066) +++ gcc/config/arm/arm.c (revision 202067) @@ -2134,6 +2134,13 @@ global_options.x_param_values, global_options_set.x_param_values); + /* Do not move invariants out of loops since it tends to increase register + pressure. The heuristic to estimate register pressure does not fit for + ARM. -fira-loop-pressure tends to get more precise estimation. But it + still need more tuning. */ + if (optimize_function_for_size_p (cfun) && !flag_ira_loop_pressure) + flag_move_loop_invariants = 0; + /* Register global variables with the garbage collector. */ arm_add_gc_roots (); }