From 5015272c8b716c80a8a3afb26572870a91c4b141 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 2 Mar 2004 16:48:54 -0800 Subject: [PATCH] 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 --- gcc/ChangeLog | 6 ++++++ gcc/optabs.c | 10 ++++++++++ 2 files changed, 16 insertions(+) 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)) -- 2.47.2