From b1435931f280564bd885cf17f84ea3ea2ef90826 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 13 Jul 2012 08:53:24 +0000 Subject: [PATCH] re PR rtl-optimization/53908 (csa removes needed memory load) PR rtl-optimization/53908 * df-problems.c (can_move_insns_across): When doing memory-reference book-keeping, handle call insns. Co-Authored-By: Bernd Schmidt Co-Authored-By: Steven Bosscher From-SVN: r189454 --- gcc/ChangeLog | 8 ++++++++ gcc/df-problems.c | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1415b3837d4..3bce65cc004 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2012-07-13 Richard Sandiford + Steven Bosscher + Bernd Schmidt + + PR rtl-optimization/53908 + * df-problems.c (can_move_insns_across): When doing + memory-reference book-keeping, handle call insns. + 2012-07-13 Richard Guenther * gimple.c (gimple_types_compatible_p_1): Remove redundant diff --git a/gcc/df-problems.c b/gcc/df-problems.c index 7afbed98283..d650d0ba415 100644 --- a/gcc/df-problems.c +++ b/gcc/df-problems.c @@ -4068,6 +4068,19 @@ can_move_insns_across (rtx from, rtx to, rtx across_from, rtx across_to, for (insn = across_to; ; insn = next) { + if (CALL_P (insn)) + { + if (RTL_CONST_OR_PURE_CALL_P (insn)) + /* Pure functions can read from memory. Const functions can + read from arguments that the ABI has forced onto the stack. + Neither sort of read can be volatile. */ + memrefs_in_across |= MEMREF_NORMAL; + else + { + memrefs_in_across |= MEMREF_VOLATILE; + mem_sets_in_across |= MEMREF_VOLATILE; + } + } if (NONDEBUG_INSN_P (insn)) { memrefs_in_across |= for_each_rtx (&PATTERN (insn), find_memory,