From eafeba3e5187a53a4c08a3285b4b220e1ab68b60 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 16 Apr 2020 09:37:44 +0200 Subject: [PATCH] middle-end/94614 - avoid multiword moves to nothing This adjusts emit_move_multi_word to handle moves into paradoxical subregs parts that are not there and adjusts lower-subregs CLOBBER resolving to deal with those as well. 2020-04-16 Richard Biener PR middle-end/94614 * expr.c (emit_move_multi_word): Do not generate code when the destination part is undefined_operand_subword_p. * lower-subreg.c (resolve_clobber): Look through a paradoxica subreg. --- gcc/ChangeLog | 8 ++++++++ gcc/expr.c | 5 +++++ gcc/lower-subreg.c | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fef2d26d88..9f2f5db6f2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2020-04-16 Richard Biener + + PR middle-end/94614 + * expr.c (emit_move_multi_word): Do not generate code when + the destination part is undefined_operand_subword_p. + * lower-subreg.c (resolve_clobber): Look through a paradoxica + subreg. + 2020-04-16 Martin Jambor PR tree-optimization/94598 diff --git a/gcc/expr.c b/gcc/expr.c index b97c217e86d..dfbeae71518 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -3692,6 +3692,11 @@ emit_move_multi_word (machine_mode mode, rtx x, rtx y) need_clobber = false; for (i = 0; i < CEIL (mode_size, UNITS_PER_WORD); i++) { + /* Do not generate code for a move if it would go entirely + to the non-existing bits of a paradoxical subreg. */ + if (undefined_operand_subword_p (x, i)) + continue; + rtx xpart = operand_subword (x, i, 1, mode); rtx ypart; diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c index a170f0ff93b..a11e535b5bf 100644 --- a/gcc/lower-subreg.c +++ b/gcc/lower-subreg.c @@ -1150,6 +1150,10 @@ resolve_clobber (rtx pat, rtx_insn *insn) int ret; reg = XEXP (pat, 0); + /* For clobbers we can look through paradoxical subregs which + we do not handle in simplify_gen_subreg_concatn. */ + if (paradoxical_subreg_p (reg)) + reg = SUBREG_REG (reg); if (!resolve_reg_p (reg) && !resolve_subreg_p (reg)) return false; -- 2.30.2