Disable -fcaller-saves by default. This patch turns off -fcaller-saves by default so that IRA doesn't try to use volatile regs for pseudos that are live across a call, which would then require LRA to save/restore the reg around the call.
Bootstrap/regtest on powerpc64le with no new regressions. Also ran a CPU2017 benchmark comparison with no major differences (a few minor improvements and one minor degradation). Ok for trunk? -Pat 2020-07-23 Pat Haugen <pthau...@linux.ibm.com> gcc/ * common/config/rs6000/rs6000-common.c (rs6000_option_optimization_table): Turn off -fcaller-saves. gcc/testsuite/ * gcc.target/powerpc/caller-saves.c: New. diff --git a/gcc/common/config/rs6000/rs6000-common.c b/gcc/common/config/rs6000/rs6000-common.c index ee37b9dc90b..6d68834aed2 100644 --- a/gcc/common/config/rs6000/rs6000-common.c +++ b/gcc/common/config/rs6000/rs6000-common.c @@ -43,8 +43,13 @@ static const struct default_options rs6000_option_optimization_table[] = on rs6000, turn it off by default. */ { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 }, + /* Don't allow IRA to use volatile regs across function calls. */ + { OPT_LEVELS_ALL, OPT_fcaller_saves, NULL, 0 }, + /* Double growth factor to counter reduced min jump length. */ { OPT_LEVELS_ALL, OPT__param_max_grow_copy_bb_insns_, NULL, 16 }, + + /* Following marks the end of the list and needs to remain last. */ { OPT_LEVELS_NONE, 0, NULL, 0 } }; diff --git a/gcc/testsuite/gcc.target/powerpc/caller-saves.c b/gcc/testsuite/gcc.target/powerpc/caller-saves.c new file mode 100644 index 00000000000..846356f16f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/caller-saves.c @@ -0,0 +1,9 @@ +/* { dg-do compile */ +/* { dg-options "-O2 -fverbose-asm" } */ + +void +foo () +{ +} + +/* { dg-final { scan-assembler-not "fcaller-saves" } } */