expr.c (expand_expr, [...]): Refine test for when to copy misaligned data.

* expr.c (expand_expr, case ADDR_EXPR): Refine test for when to
	copy misaligned data.
	* varasm.c (assemble_variable): Set alignment into MEM when changed.

From-SVN: r47089
This commit is contained in:
Richard Kenner 2001-11-16 14:02:56 +00:00 committed by Richard Kenner
parent f4dc10d1cb
commit c952ff4b08
3 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,9 @@
Fri Nov 16 09:06:25 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (expand_expr, case ADDR_EXPR): Refine test for when to
copy misaligned data.
* varasm.c (assemble_variable): Set alignment into MEM when changed.
2001-11-16 Graham Stott <grahams@redhat.com>
* optabs.c (prepare_cmp_insn): Correct lossage in last change fix

View File

@ -8649,11 +8649,19 @@ expand_expr (exp, target, tmode, modifier)
return op0;
}
/* If OP0 is not aligned as least as much as the type requires,
we need to make a temporary, copy OP0 to it, and take the
address of the temporary. */
if (GET_MODE (op0) == BLKmode
&& expr_align (TREE_OPERAND (exp, 0)) > MEM_ALIGN (op0))
/* If OP0 is not aligned as least as much as the type requires, we
need to make a temporary, copy OP0 to it, and take the address of
the temporary. We want to use the alignment of the type, not of
the operand. Note that this is incorrect for FUNCTION_TYPE, but
the test for BLKmode means that can't happen. The test for
BLKmode is because we never make mis-aligned MEMs with
non-BLKmode.
We don't need to do this at all if the machine doesn't have
strict alignment. */
if (STRICT_ALIGNMENT && GET_MODE (op0) == BLKmode
&& (TYPE_ALIGN (TREE_TYPE (TREE_OPERAND (exp, 0)))
> MEM_ALIGN (op0)))
{
tree inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
rtx new

View File

@ -1615,6 +1615,7 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
/* Reset the alignment in case we have made it tighter, so we can benefit
from it in get_pointer_alignment. */
DECL_ALIGN (decl) = align;
set_mem_align (decl_rtl, align);
/* Handle uninitialized definitions. */