diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-09-05 13:30:23 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-09-05 13:30:23 +0000 |
commit | d9743e50275079b8b61e8a365eacfc375be4272d (patch) | |
tree | fe8d6c7512fc1b1137aa84003bd9b504d3d69998 /gcc/calls.c | |
parent | 26d2429145d213d27cc81f675197182538ea8c5e (diff) |
PR middle-end/91001
PR middle-end/91105
PR middle-end/91106
* calls.c (load_register_parameters): For TYPE_TRANSPARENT_AGGR
types, use type of their first field instead of type of
args[i].tree_value.
* gcc.c-torture/compile/pr91001.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275408 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 6eefeec17d9..e5086f4bb1d 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2771,6 +2771,11 @@ load_register_parameters (struct arg_data *args, int num_actuals, poly_int64 size = 0; HOST_WIDE_INT const_size = 0; rtx_insn *before_arg = get_last_insn (); + tree type = TREE_TYPE (args[i].tree_value); + if ((TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == RECORD_TYPE) + && TYPE_TRANSPARENT_AGGR (type)) + type = TREE_TYPE (first_field (type)); /* Set non-negative if we must move a word at a time, even if just one word (e.g, partial == 4 && mode == DFmode). Set to -1 if we just use a normal move insn. This value can be @@ -2783,11 +2788,11 @@ load_register_parameters (struct arg_data *args, int num_actuals, gcc_assert (partial % UNITS_PER_WORD == 0); nregs = partial / UNITS_PER_WORD; } - else if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode) + else if (TYPE_MODE (type) == BLKmode) { /* Variable-sized parameters should be described by a PARALLEL instead. */ - const_size = int_size_in_bytes (TREE_TYPE (args[i].tree_value)); + const_size = int_size_in_bytes (type); gcc_assert (const_size >= 0); nregs = (const_size + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD; size = const_size; @@ -2914,8 +2919,7 @@ load_register_parameters (struct arg_data *args, int num_actuals, if (GET_CODE (reg) == PARALLEL) use_group_regs (call_fusage, reg); else if (nregs == -1) - use_reg_mode (call_fusage, reg, - TYPE_MODE (TREE_TYPE (args[i].tree_value))); + use_reg_mode (call_fusage, reg, TYPE_MODE (type)); else if (nregs > 0) use_regs (call_fusage, REGNO (reg), nregs); } |