From: Richard Henderson Date: Wed, 3 Mar 2004 00:48:54 +0000 (-0800) Subject: re PR middle-end/11767 (different code behaviour with -fnon-call-exceptions -fprofile... X-Git-Tag: releases/gcc-3.3.4~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5015272c8b716c80a8a3afb26572870a91c4b141;p=thirdparty%2Fgcc.git re PR middle-end/11767 (different code behaviour with -fnon-call-exceptions -fprofile-arcs) PR middle-end/11767 * 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: r78808 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 139b25a35b5c..45a72b864047 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-03-02 Richard Henderson + + PR middle-end/11767 + * 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/optabs.c b/gcc/optabs.c index d4eb640a71cb..9da601c4f84d 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3476,6 +3476,16 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, purpose) 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))