From: Jakub Jelinek Date: Fri, 26 Jan 2018 11:48:05 +0000 (+0100) Subject: re PR rtl-optimization/83985 (Compile time hog for 32-bit BE powerpc targets) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=45399fdc7c120342bb1b84595e0d54deb58c7235;p=gcc.git re PR rtl-optimization/83985 (Compile time hog for 32-bit BE powerpc targets) PR rtl-optimization/83985 * dce.c (deletable_insn_p): Return false for separate shrink wrapping REG_CFA_RESTORE insns. (delete_unmarked_insns): Don't ignore separate shrink wrapping REG_CFA_RESTORE insns here. * gcc.dg/pr83985.c: New test. From-SVN: r257087 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 32fb7baf591..764368ae20a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2018-01-26 Jakub Jelinek + PR rtl-optimization/83985 + * dce.c (deletable_insn_p): Return false for separate shrink wrapping + REG_CFA_RESTORE insns. + (delete_unmarked_insns): Don't ignore separate shrink wrapping + REG_CFA_RESTORE insns here. + PR c/83989 * gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Don't use SSA_NAME_VAR as base for SSA_NAMEs with non-NULL SSA_NAME_VAR. diff --git a/gcc/dce.c b/gcc/dce.c index 590b6874e53..e00d029db65 100644 --- a/gcc/dce.c +++ b/gcc/dce.c @@ -131,6 +131,12 @@ deletable_insn_p (rtx_insn *insn, bool fast, bitmap arg_stores) && REGNO (pic_offset_table_rtx) >= FIRST_PSEUDO_REGISTER) return false; + /* Callee-save restores are needed. */ + if (RTX_FRAME_RELATED_P (insn) + && crtl->shrink_wrapped_separate + && find_reg_note (insn, REG_CFA_RESTORE, NULL)) + return false; + body = PATTERN (insn); switch (GET_CODE (body)) { @@ -592,15 +598,6 @@ delete_unmarked_insns (void) if (!dbg_cnt (dce)) continue; - if (crtl->shrink_wrapped_separate - && find_reg_note (insn, REG_CFA_RESTORE, NULL)) - { - if (dump_file) - fprintf (dump_file, "DCE: NOT deleting insn %d, it's a " - "callee-save restore\n", INSN_UID (insn)); - continue; - } - if (dump_file) fprintf (dump_file, "DCE: Deleting insn %d\n", INSN_UID (insn)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c484d5b7ffe..5fa94c88af9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-01-26 Jakub Jelinek + PR rtl-optimization/83985 + * gcc.dg/pr83985.c: New test. + PR c/83989 * c-c++-common/Wrestrict-3.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr83985.c b/gcc/testsuite/gcc.dg/pr83985.c new file mode 100644 index 00000000000..51cfc49a193 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr83985.c @@ -0,0 +1,25 @@ +/* PR rtl-optimization/83985 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-mcpu=e300c3 -mtune=e300c3" { target { powerpc*-*-* && ilp32 } } } */ + +long long int v; + +void +foo (int x) +{ + if (x == 0) + return; + + while (v < 2) + { + signed char *a; + v /= x; + a = v == 0 ? (signed char *) &x : (signed char *) &v; + ++*a; + ++v; + } + + while (1) + ; +}