From 5e21e8e70fbb9ae0ec8f6c29daeee0412dc10fbf Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Wed, 22 May 2019 00:35:32 +0000 Subject: [PATCH] re PR middle-end/90553 (Register allocation allocates post-incremented address-load of call to call-clobbered register) PR middle-end/90553 * ira-lives.c (process_bb_node_lives): Consider defs for a call insn to be die before the call, not after. From-SVN: r271498 --- gcc/ChangeLog | 4 ++++ gcc/ira-lives.c | 16 +++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9c4c21589ca..e5e0fe18159 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2019-05-22 Hans-Peter Nilsson + PR middle-end/90553 + * ira-lives.c (process_bb_node_lives): Consider defs + for a call insn to be die before the call, not after. + * function.c (assign_parm_setup_block): Raise alignment of stacked parameter only for STRICT_ALIGNMENT targets. diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c index faadf08b073..581fdd36aa4 100644 --- a/gcc/ira-lives.c +++ b/gcc/ira-lives.c @@ -1241,11 +1241,6 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) preprocess_constraints (insn); process_single_reg_class_operands (false, freq); - /* See which defined values die here. */ - FOR_EACH_INSN_DEF (def, insn) - if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER)) - mark_ref_dead (def); - if (call_p) { /* Try to find a SET in the CALL_INSN_FUNCTION_USAGE, and from @@ -1309,6 +1304,17 @@ process_bb_node_lives (ira_loop_tree_node_t loop_tree_node) } } + /* See which defined values die here. Note that we include + the call insn in the lifetimes of these values, so we don't + mistakenly consider, for e.g. an addressing mode with a + side-effect like a post-increment fetching the address, + that the use happens before the call, and the def to happen + after the call: we believe both to happen before the actual + call. (We don't handle return-values here.) */ + FOR_EACH_INSN_DEF (def, insn) + if (!call_p || !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER)) + mark_ref_dead (def); + make_early_clobber_and_input_conflicts (); curr_point++; -- 2.30.2