From 7ead14d420b671bbc3e3eff8976fa80b09a7766b Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 5 Mar 2013 23:25:43 +0100 Subject: [PATCH] re PR rtl-optimization/56484 (ICE in assign_by_spills, at lra-assigns.c:1268) PR rtl-optimization/56484 * ifcvt.c (noce_process_if_block): If else_bb is NULL, avoid extending lifetimes of hard registers on small register class machines. From-SVN: r196478 --- gcc/ifcvt.c | 6 ++++++ gcc/testsuite/gcc.c-torture/compile/pr56484.c | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr56484.c diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index dd941006535..f081ecd3353 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -2491,6 +2491,12 @@ noce_process_if_block (struct noce_if_info *if_info) || ! noce_operand_ok (SET_SRC (set_b)) || reg_overlap_mentioned_p (x, SET_SRC (set_b)) || modified_between_p (SET_SRC (set_b), insn_b, jump) + /* Avoid extending the lifetime of hard registers on small + register class machines. */ + || (REG_P (SET_SRC (set_b)) + && HARD_REGISTER_P (SET_SRC (set_b)) + && targetm.small_register_classes_for_mode_p + (GET_MODE (SET_SRC (set_b)))) /* Likewise with X. In particular this can happen when noce_get_condition looks farther back in the instruction stream than one might expect. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr56484.c b/gcc/testsuite/gcc.c-torture/compile/pr56484.c new file mode 100644 index 00000000000..894862cd461 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr56484.c @@ -0,0 +1,17 @@ +/* PR rtl-optimization/56484 */ + +unsigned char b[4096]; +int bar (void); + +int +foo (void) +{ + int a = 0; + while (bar ()) + { + int c = bar (); + a = a < 0 ? a : c; + __builtin_memset (b, 0, sizeof b); + } + return a; +} -- 2.30.2