From patchwork Tue Jul 9 08:07:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [GCC/ARM] Disable "-fira-hoist-pressure" on Thumb2 X-Patchwork-Submitter: Bin Cheng X-Patchwork-Id: 257662 Message-Id: <00f001ce7c7b$820e9b20$862bd160$@cheng@arm.com> To: Date: Tue, 9 Jul 2013 16:07:54 +0800 From: "Bin Cheng" List-Id: Hi, For now the option "-fira-hoist-pressure" is enabled for all targets, but I monitored performance regression with Os on thumb2 for some cases. Considering that optimization has small improvement on thumb2 for code size, here comes this patch disabling it on Thumb2 and modifying the corresponding test cases. Tested on arm-none-eabi/M3, is it OK? Thanks. bin 2013-04-25 Bin Cheng * common.opt (flag_ira_hoist_pressure): Initialize to 2. * doc/invoke.texi (-fira-hoist-pressure): Disabled by default on Thumb2 instruction set. * config/arm/arm.c (arm_option_override): Disable option -fira-hoist-pressure on Thumb2 by default. 2013-04-25 Bin Cheng * gcc.dg/hoist-register-pressure-1.c: Add -fira-hoist-pressure option. * gcc.dg/hoist-register-pressure-2.c: Ditto. * gcc.dg/hoist-register-pressure-3.c: Ditto. Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 197029) +++ gcc/common.opt (working copy) @@ -1397,7 +1397,7 @@ EnumValue Enum(ira_region) String(mixed) Value(IRA_REGION_MIXED) fira-hoist-pressure -Common Report Var(flag_ira_hoist_pressure) Init(1) Optimization +Common Report Var(flag_ira_hoist_pressure) Init(2) Optimization Use IRA based register pressure calculation in RTL hoist optimizations. Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 197029) +++ gcc/config/arm/arm.c (working copy) @@ -2095,6 +2095,12 @@ arm_option_override (void) else max_insns_skipped = current_tune->max_insns_skipped; + if (TARGET_THUMB2 && flag_ira_hoist_pressure == 2) + { + /* Don't do register pressure directed hoist on Thumb2 by default. */ + flag_ira_hoist_pressure = 0; + } + /* Hot/Cold partitioning is not currently supported, since we can't handle literal pool placement in that case. */ if (flag_reorder_blocks_and_partition) Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 197029) +++ gcc/doc/invoke.texi (working copy) @@ -7160,7 +7160,7 @@ Use IRA to evaluate register pressure in the code decisions to hoist expressions. This option usually results in smaller code, but it can slow the compiler down. -This option is enabled at level @option{-Os} for all targets. +This option is enabled at level @option{-Os} for most targets. @item -fira-loop-pressure @opindex fira-loop-pressure Index: gcc/testsuite/gcc.dg/hoist-register-pressure-1.c =================================================================== --- gcc/testsuite/gcc.dg/hoist-register-pressure-1.c (revision 197029) +++ gcc/testsuite/gcc.dg/hoist-register-pressure-1.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-options "-Os -fdump-rtl-hoist" } */ +/* { dg-options "-Os -fira-hoist-pressure -fdump-rtl-hoist" } */ /* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" { target { nonpic } } } } */ /* { dg-final { cleanup-rtl-dump "hoist" } } */ Index: gcc/testsuite/gcc.dg/hoist-register-pressure-2.c =================================================================== --- gcc/testsuite/gcc.dg/hoist-register-pressure-2.c (revision 197029) +++ gcc/testsuite/gcc.dg/hoist-register-pressure-2.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-options "-Os -fdump-rtl-hoist" } */ +/* { dg-options "-Os -fira-hoist-pressure -fdump-rtl-hoist" } */ /* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" } } */ /* { dg-final { cleanup-rtl-dump "hoist" } } */ Index: gcc/testsuite/gcc.dg/hoist-register-pressure-3.c =================================================================== --- gcc/testsuite/gcc.dg/hoist-register-pressure-3.c (revision 197029) +++ gcc/testsuite/gcc.dg/hoist-register-pressure-3.c (working copy) @@ -1,4 +1,4 @@ -/* { dg-options "-Os -fdump-rtl-hoist" } */ +/* { dg-options "-Os -fira-hoist-pressure -fdump-rtl-hoist" } */ /* { dg-final { scan-rtl-dump "PRE/HOIST: end of bb .* copying expression" "hoist" } } */ /* { dg-final { cleanup-rtl-dump "hoist" } } */