From: Richard Henderson Date: Wed, 3 Mar 2004 00:46:06 +0000 (-0800) Subject: re PR middle-end/11767 (different code behaviour with -fnon-call-exceptions -fprofile... X-Git-Tag: releases/gcc-4.0.0~9672 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=27ab3e91289ff7946c6a477de84bddb707d3f74d;p=thirdparty%2Fgcc.git re PR middle-end/11767 (different code behaviour with -fnon-call-exceptions -fprofile-arcs) PR middle-end/11767 * coverage.c (coverage_counter_ref): Set MEM_NOTRAP_P. * optabs.c (prepare_cmp_insn): Force trapping memories to registers before the compare, if flag_non_call_exceptions. * g++.dg/other/profile1.C: New. From-SVN: r78805 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a8e3331442a..ebcd2ec39d66 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-03-02 Richard Henderson + + PR middle-end/11767 + * coverage.c (coverage_counter_ref): Set MEM_NOTRAP_P. + * optabs.c (prepare_cmp_insn): Force trapping memories to registers + before the compare, if flag_non_call_exceptions. + 2004-03-02 Richard Henderson PR middle-end/14327 diff --git a/gcc/coverage.c b/gcc/coverage.c index 6d6f3b8b36fa..d045d79358cc 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -399,6 +399,7 @@ coverage_counter_ref (unsigned counter, unsigned no) ref = plus_constant (ctr_labels[counter], gcov_size / BITS_PER_UNIT * no); ref = gen_rtx_MEM (mode, ref); set_mem_alias_set (ref, new_alias_set ()); + MEM_NOTRAP_P (ref) = 1; return ref; } diff --git a/gcc/optabs.c b/gcc/optabs.c index cf3099b35239..0826782473f1 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3650,6 +3650,16 @@ prepare_cmp_insn (rtx *px, rtx *py, enum rtx_code *pcomparison, rtx size, return; } + /* Don't allow operands to the compare to trap, as that can put the + compare and branch in different basic blocks. */ + if (flag_non_call_exceptions) + { + if (may_trap_p (x)) + x = force_reg (mode, x); + if (may_trap_p (y)) + y = force_reg (mode, y); + } + *px = x; *py = y; if (can_compare_p (*pcomparison, mode, purpose))