revisit PR middle-end/56848 for 4.7.4. as outlined in the bug report, this reapplies the patch backed out for the 4.7.3 release and backports r190733. No regressions in the testsuite on x86_64-linux-gnu compared to the 4.7.3 release. Ok to apply?
Matthias
gcc/ 2013-04-18 Matthias Klose <d...@ubuntu.com> PR middle-end/56848 Re-apply 2013-04-01 Andrey Belevantsev <a...@ispras.ru> Backport from mainline 2013-02-25 Andrey Belevantsev <a...@ispras.ru> Alexander Monakov <amona...@ispras.ru> PR middle-end/56077 * sched-deps.c (sched_analyze_insn): When reg_pending_barrier, flush pending lists also on non-jumps. Adjust comment. Backport: 2012-08-27 Maxim Kuvyrkov <ma...@codesourcery.com> * sched-deps.c (add_dependence_list_and_free): Simplify. (flush_pending_list_and_free): Fix a hack that was fixing a hack. Free lists when add_dependence_list_and_free doesn't free them. Index: gcc/sched-deps.c =================================================================== --- a/src/gcc/sched-deps.c (revision 198053) +++ b/src/gcc/sched-deps.c (working copy) @@ -1563,24 +1563,15 @@ add_dependence_list_and_free (struct deps_desc *deps, rtx insn, rtx *listp, int uncond, enum reg_note dep_type) { - rtx list, next; + add_dependence_list (insn, *listp, uncond, dep_type); /* We don't want to short-circuit dependencies involving debug insns, because they may cause actual dependencies to be disregarded. */ if (deps->readonly || DEBUG_INSN_P (insn)) - { - add_dependence_list (insn, *listp, uncond, dep_type); - return; - } + return; - for (list = *listp, *listp = NULL; list ; list = next) - { - next = XEXP (list, 1); - if (uncond || ! sched_insns_conditions_mutex_p (insn, XEXP (list, 0))) - add_dependence (insn, XEXP (list, 0), dep_type); - free_INSN_LIST_node (list); - } + free_INSN_LIST_list (listp); } /* Remove all occurences of INSN from LIST. Return the number of @@ -1764,6 +1755,15 @@ add_dependence_list_and_free (deps, insn, &deps->pending_jump_insns, 1, REG_DEP_ANTI); + if (DEBUG_INSN_P (insn)) + { + if (for_write) + free_INSN_LIST_list (&deps->pending_read_insns); + free_INSN_LIST_list (&deps->pending_write_insns); + free_INSN_LIST_list (&deps->last_pending_memory_flush); + free_INSN_LIST_list (&deps->pending_jump_insns); + } + if (!deps->readonly) { free_EXPR_LIST_list (&deps->pending_write_mems); @@ -3262,9 +3262,9 @@ SET_REGNO_REG_SET (&deps->reg_last_in_use, i); } - /* Flush pending lists on jumps, but not on speculative checks. */ - if (JUMP_P (insn) && !(sel_sched_p () - && sel_insn_is_speculation_check (insn))) + /* Don't flush pending lists on speculative checks for + selective scheduling. */ + if (!sel_sched_p () || !sel_insn_is_speculation_check (insn)) flush_pending_lists (deps, insn, true, true); reg_pending_barrier = NOT_A_BARRIER;