From a9f3126aad1238959612daf004c45f139a9737c0 Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Sun, 8 Oct 2017 08:20:25 +0000 Subject: [PATCH] arm.c (arm_set_return_address): Use MEM_VOLATILE_P on the target mem instead of RTX_FRAME_RELATED_P on the insn... 2017-10-08 Olivier Hainque * config/arm/arm.c (arm_set_return_address): Use MEM_VOLATILE_P on the target mem instead of RTX_FRAME_RELATED_P on the insn to prevent DSE. (thumb_set_return_address): Likewise. From-SVN: r253522 --- gcc/ChangeLog | 7 +++++++ gcc/config/arm/arm.c | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b44775caff2..c4a7c62b477 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-10-08 Olivier Hainque + + * config/arm/arm.c (arm_set_return_address): Use MEM_VOLATILE_P + on the target mem instead of RTX_FRAME_RELATED_P on the insn to + prevent DSE. + (thumb_set_return_address): Likewise. + 2017-10-08 Olivier Hainque * common/config/arm/arm-common.c (arm_except_unwind_info): diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index bece1f76011..622218c60ef 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -26859,7 +26859,7 @@ arm_set_return_address (rtx source, rtx scratch) { arm_stack_offsets *offsets; HOST_WIDE_INT delta; - rtx addr; + rtx addr, mem; unsigned long saved_regs; offsets = arm_get_frame_offsets (); @@ -26889,11 +26889,12 @@ arm_set_return_address (rtx source, rtx scratch) addr = plus_constant (Pmode, addr, delta); } - /* The store needs to be marked as frame related in order to prevent - DSE from deleting it as dead if it is based on fp. */ - rtx insn = emit_move_insn (gen_frame_mem (Pmode, addr), source); - RTX_FRAME_RELATED_P (insn) = 1; - add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (Pmode, LR_REGNUM)); + + /* The store needs to be marked to prevent DSE from deleting + it as dead if it is based on fp. */ + mem = gen_frame_mem (Pmode, addr); + MEM_VOLATILE_P (mem) = true; + emit_move_insn (mem, source); } } @@ -26905,7 +26906,7 @@ thumb_set_return_address (rtx source, rtx scratch) HOST_WIDE_INT delta; HOST_WIDE_INT limit; int reg; - rtx addr; + rtx addr, mem; unsigned long mask; emit_use (source); @@ -26945,11 +26946,11 @@ thumb_set_return_address (rtx source, rtx scratch) else addr = plus_constant (Pmode, addr, delta); - /* The store needs to be marked as frame related in order to prevent - DSE from deleting it as dead if it is based on fp. */ - rtx insn = emit_move_insn (gen_frame_mem (Pmode, addr), source); - RTX_FRAME_RELATED_P (insn) = 1; - add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (Pmode, LR_REGNUM)); + /* The store needs to be marked to prevent DSE from deleting + it as dead if it is based on fp. */ + mem = gen_frame_mem (Pmode, addr); + MEM_VOLATILE_P (mem) = true; + emit_move_insn (mem, source); } else emit_move_insn (gen_rtx_REG (Pmode, LR_REGNUM), source); -- 2.30.2