Those functions now return conservative alignments and all callers that call them with an argument of BIGGEST_ALIGNMENT do so without any good reason. If the functions return a larger alignment then it is known to be larger.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2011-08-10 Richard Guenther <rguent...@suse.de> * tree.h (get_pointer_alignment): Remove max-align argument. (get_object_alignment): Likewise. * builtins.c (get_object_alignment_1): Adjust. (get_object_alignment): Remove max-align argument. (get_pointer_alignment): Likewise. (expand_builtin_strlen): Adjust. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy_args): Likewise. (expand_builtin_strncpy): Likewise. (expand_builtin_memset_args): Likewise. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (get_builtin_sync_mem): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_memory_op): Likewise. (expand_builtin_memory_chk): Likewise. * emit-rtl.c (get_mem_align_offset): Likewise. (set_mem_attributes_minus_bitpos): Likewise. * expr.c (expand_assignment): Likewise. (expand_expr_real_1): Likewise. * tree-sra.c (tree_non_mode_aligned_mem_p): Likewise. * tree-ssa-forwprop.c (simplify_builtin_call): Likewise. * tree-ssa-loop-ivopts.c (may_be_unaligned_p): Likewise. * tree-vect-data-refs.c (vect_compute_data_ref_alignment): Likewise. * value-prof.c (gimple_stringops_transform): Likewise. Index: gcc/tree.h =================================================================== *** gcc/tree.h.orig 2011-08-10 11:22:33.000000000 +0200 --- gcc/tree.h 2011-08-10 14:15:14.000000000 +0200 *************** extern tree build_string_literal (int, c *** 5359,5369 **** extern bool validate_arglist (const_tree, ...); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); extern bool can_trust_pointer_alignment (void); - extern unsigned int get_pointer_alignment (tree, unsigned int); extern bool is_builtin_name (const char *); extern bool is_builtin_fn (tree); extern unsigned int get_object_alignment_1 (tree, unsigned HOST_WIDE_INT *); ! extern unsigned int get_object_alignment (tree, unsigned int); extern tree fold_call_stmt (gimple, bool); extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function); extern tree make_range (tree, int *, tree *, tree *, bool *); --- 5359,5369 ---- extern bool validate_arglist (const_tree, ...); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); extern bool can_trust_pointer_alignment (void); extern bool is_builtin_name (const char *); extern bool is_builtin_fn (tree); extern unsigned int get_object_alignment_1 (tree, unsigned HOST_WIDE_INT *); ! extern unsigned int get_object_alignment (tree); ! extern unsigned int get_pointer_alignment (tree); extern tree fold_call_stmt (gimple, bool); extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function); extern tree make_range (tree, int *, tree *, tree *, bool *); Index: gcc/builtins.c =================================================================== *** gcc/builtins.c.orig 2011-08-10 11:22:33.000000000 +0200 --- gcc/builtins.c 2011-08-10 14:16:05.000000000 +0200 *************** get_object_alignment_1 (tree exp, unsign *** 341,347 **** align = MAX (pi->align * BITS_PER_UNIT, align); } else if (TREE_CODE (addr) == ADDR_EXPR) ! align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0), ~0U)); bitpos += mem_ref_offset (exp).low * BITS_PER_UNIT; } else if (TREE_CODE (exp) == TARGET_MEM_REF) --- 341,347 ---- align = MAX (pi->align * BITS_PER_UNIT, align); } else if (TREE_CODE (addr) == ADDR_EXPR) ! align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0))); bitpos += mem_ref_offset (exp).low * BITS_PER_UNIT; } else if (TREE_CODE (exp) == TARGET_MEM_REF) *************** get_object_alignment_1 (tree exp, unsign *** 365,371 **** align = MAX (pi->align * BITS_PER_UNIT, align); } else if (TREE_CODE (addr) == ADDR_EXPR) ! align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0), ~0U)); if (TMR_OFFSET (exp)) bitpos += TREE_INT_CST_LOW (TMR_OFFSET (exp)) * BITS_PER_UNIT; if (TMR_INDEX (exp) && TMR_STEP (exp)) --- 365,371 ---- align = MAX (pi->align * BITS_PER_UNIT, align); } else if (TREE_CODE (addr) == ADDR_EXPR) ! align = MAX (align, get_object_alignment (TREE_OPERAND (addr, 0))); if (TMR_OFFSET (exp)) bitpos += TREE_INT_CST_LOW (TMR_OFFSET (exp)) * BITS_PER_UNIT; if (TMR_INDEX (exp) && TMR_STEP (exp)) *************** get_object_alignment_1 (tree exp, unsign *** 434,444 **** return align; } ! /* Return the alignment in bits of EXP, an object. ! Don't return more than MAX_ALIGN no matter what. */ unsigned int ! get_object_alignment (tree exp, unsigned int max_align) { unsigned HOST_WIDE_INT bitpos = 0; unsigned int align; --- 434,443 ---- return align; } ! /* Return the alignment in bits of EXP, an object. */ unsigned int ! get_object_alignment (tree exp) { unsigned HOST_WIDE_INT bitpos = 0; unsigned int align; *************** get_object_alignment (tree exp, unsigned *** 451,457 **** if (bitpos != 0) align = (bitpos & -bitpos); ! return MIN (align, max_align); } /* Returns true iff we can trust that alignment information has been --- 450,456 ---- if (bitpos != 0) align = (bitpos & -bitpos); ! return align; } /* Returns true iff we can trust that alignment information has been *************** can_trust_pointer_alignment (void) *** 465,471 **** } /* Return the alignment in bits of EXP, a pointer valued expression. - But don't return more than MAX_ALIGN no matter what. The alignment returned is, by default, the alignment of the thing that EXP points to. If it is not a POINTER_TYPE, 0 is returned. --- 464,469 ---- *************** can_trust_pointer_alignment (void) *** 473,484 **** expression is actually pointing at an object whose alignment is tighter. */ unsigned int ! get_pointer_alignment (tree exp, unsigned int max_align) { STRIP_NOPS (exp); if (TREE_CODE (exp) == ADDR_EXPR) ! return get_object_alignment (TREE_OPERAND (exp, 0), max_align); else if (TREE_CODE (exp) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (exp))) { --- 471,482 ---- expression is actually pointing at an object whose alignment is tighter. */ unsigned int ! get_pointer_alignment (tree exp) { STRIP_NOPS (exp); if (TREE_CODE (exp) == ADDR_EXPR) ! return get_object_alignment (TREE_OPERAND (exp, 0)); else if (TREE_CODE (exp) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (exp))) { *************** get_pointer_alignment (tree exp, unsigne *** 490,496 **** align = (pi->misalign & -pi->misalign); else align = pi->align; ! return MIN (max_align, align * BITS_PER_UNIT); } return POINTER_TYPE_P (TREE_TYPE (exp)) ? BITS_PER_UNIT : 0; --- 488,494 ---- align = (pi->misalign & -pi->misalign); else align = pi->align; ! return align * BITS_PER_UNIT; } return POINTER_TYPE_P (TREE_TYPE (exp)) ? BITS_PER_UNIT : 0; *************** expand_builtin_strlen (tree exp, rtx tar *** 2926,2932 **** return expand_expr (len, target, target_mode, EXPAND_NORMAL); } ! align = get_pointer_alignment (src, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; /* If SRC is not a pointer type, don't do this operation inline. */ if (align == 0) --- 2924,2930 ---- return expand_expr (len, target, target_mode, EXPAND_NORMAL); } ! align = get_pointer_alignment (src) / BITS_PER_UNIT; /* If SRC is not a pointer type, don't do this operation inline. */ if (align == 0) *************** expand_builtin_memcpy (tree exp, rtx tar *** 3026,3034 **** tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); const char *src_str; ! unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); ! unsigned int dest_align ! = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); rtx dest_mem, src_mem, dest_addr, len_rtx; HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; --- 3024,3031 ---- tree src = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); const char *src_str; ! unsigned int src_align = get_pointer_alignment (src); ! unsigned int dest_align = get_pointer_alignment (dest); rtx dest_mem, src_mem, dest_addr, len_rtx; HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; *************** expand_builtin_mempcpy_args (tree dest, *** 3135,3143 **** else { const char *src_str; ! unsigned int src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); ! unsigned int dest_align ! = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); rtx dest_mem, src_mem, len_rtx; /* If either SRC or DEST is not a pointer type, don't do this --- 3132,3139 ---- else { const char *src_str; ! unsigned int src_align = get_pointer_alignment (src); ! unsigned int dest_align = get_pointer_alignment (dest); rtx dest_mem, src_mem, len_rtx; /* If either SRC or DEST is not a pointer type, don't do this *************** expand_builtin_strncpy (tree exp, rtx ta *** 3390,3397 **** use store_by_pieces, if it fails, punt. */ if (tree_int_cst_lt (slen, len)) { ! unsigned int dest_align ! = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); const char *p = c_getstr (src); rtx dest_mem; --- 3386,3392 ---- use store_by_pieces, if it fails, punt. */ if (tree_int_cst_lt (slen, len)) { ! unsigned int dest_align = get_pointer_alignment (dest); const char *p = c_getstr (src); rtx dest_mem; *************** expand_builtin_memset_args (tree dest, t *** 3495,3501 **** HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; ! dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); /* If DEST is not a pointer type, don't do this operation in-line. */ if (dest_align == 0) --- 3490,3496 ---- HOST_WIDE_INT expected_size = -1; unsigned int expected_align = 0; ! dest_align = get_pointer_alignment (dest); /* If DEST is not a pointer type, don't do this operation in-line. */ if (dest_align == 0) *************** expand_builtin_memcmp (tree exp, ATTRIBU *** 3657,3666 **** tree arg2 = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); ! unsigned int arg1_align ! = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; ! unsigned int arg2_align ! = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; enum machine_mode insn_mode; #ifdef HAVE_cmpmemsi --- 3652,3659 ---- tree arg2 = CALL_EXPR_ARG (exp, 1); tree len = CALL_EXPR_ARG (exp, 2); ! unsigned int arg1_align = get_pointer_alignment (arg1) / BITS_PER_UNIT; ! unsigned int arg2_align = get_pointer_alignment (arg2) / BITS_PER_UNIT; enum machine_mode insn_mode; #ifdef HAVE_cmpmemsi *************** expand_builtin_strcmp (tree exp, ATTRIBU *** 3759,3768 **** tree arg1 = CALL_EXPR_ARG (exp, 0); tree arg2 = CALL_EXPR_ARG (exp, 1); ! unsigned int arg1_align ! = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; ! unsigned int arg2_align ! = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; /* If we don't have POINTER_TYPE, call the function. */ if (arg1_align == 0 || arg2_align == 0) --- 3752,3759 ---- tree arg1 = CALL_EXPR_ARG (exp, 0); tree arg2 = CALL_EXPR_ARG (exp, 1); ! unsigned int arg1_align = get_pointer_alignment (arg1) / BITS_PER_UNIT; ! unsigned int arg2_align = get_pointer_alignment (arg2) / BITS_PER_UNIT; /* If we don't have POINTER_TYPE, call the function. */ if (arg1_align == 0 || arg2_align == 0) *************** expand_builtin_strncmp (tree exp, ATTRIB *** 3910,3919 **** tree arg2 = CALL_EXPR_ARG (exp, 1); tree arg3 = CALL_EXPR_ARG (exp, 2); ! unsigned int arg1_align ! = get_pointer_alignment (arg1, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; ! unsigned int arg2_align ! = get_pointer_alignment (arg2, BIGGEST_ALIGNMENT) / BITS_PER_UNIT; enum machine_mode insn_mode = insn_data[(int) CODE_FOR_cmpstrnsi].operand[0].mode; --- 3901,3908 ---- tree arg2 = CALL_EXPR_ARG (exp, 1); tree arg3 = CALL_EXPR_ARG (exp, 2); ! unsigned int arg1_align = get_pointer_alignment (arg1) / BITS_PER_UNIT; ! unsigned int arg2_align = get_pointer_alignment (arg2) / BITS_PER_UNIT; enum machine_mode insn_mode = insn_data[(int) CODE_FOR_cmpstrnsi].operand[0].mode; *************** get_builtin_sync_mem (tree loc, enum mac *** 5087,5093 **** /* The alignment needs to be at least according to that of the mode. */ set_mem_align (mem, MAX (GET_MODE_ALIGNMENT (mode), ! get_pointer_alignment (loc, BIGGEST_ALIGNMENT))); set_mem_alias_set (mem, ALIAS_SET_MEMORY_BARRIER); MEM_VOLATILE_P (mem) = 1; --- 5076,5082 ---- /* The alignment needs to be at least according to that of the mode. */ set_mem_align (mem, MAX (GET_MODE_ALIGNMENT (mode), ! get_pointer_alignment (loc))); set_mem_alias_set (mem, ALIAS_SET_MEMORY_BARRIER); MEM_VOLATILE_P (mem) = 1; *************** fold_builtin_memset (location_t loc, tre *** 7891,7898 **** length = tree_low_cst (len, 1); if (GET_MODE_SIZE (TYPE_MODE (etype)) != length ! || get_pointer_alignment (dest, BIGGEST_ALIGNMENT) / BITS_PER_UNIT ! < length) return NULL_TREE; if (length > HOST_BITS_PER_WIDE_INT / BITS_PER_UNIT) --- 7880,7886 ---- length = tree_low_cst (len, 1); if (GET_MODE_SIZE (TYPE_MODE (etype)) != length ! || get_pointer_alignment (dest) / BITS_PER_UNIT < length) return NULL_TREE; if (length > HOST_BITS_PER_WIDE_INT / BITS_PER_UNIT) *************** fold_builtin_memory_op (location_t loc, *** 7982,7989 **** if (endp == 3) { ! src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); ! dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); /* Both DEST and SRC must be pointer types. ??? This is what old code did. Is the testing for pointer types --- 7970,7977 ---- if (endp == 3) { ! src_align = get_pointer_alignment (src); ! dest_align = get_pointer_alignment (dest); /* Both DEST and SRC must be pointer types. ??? This is what old code did. Is the testing for pointer types *************** fold_builtin_memory_op (location_t loc, *** 8131,8138 **** || TREE_ADDRESSABLE (desttype)) return NULL_TREE; ! src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); ! dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); if (dest_align < TYPE_ALIGN (desttype) || src_align < TYPE_ALIGN (srctype)) return NULL_TREE; --- 8119,8126 ---- || TREE_ADDRESSABLE (desttype)) return NULL_TREE; ! src_align = get_pointer_alignment (src); ! dest_align = get_pointer_alignment (dest); if (dest_align < TYPE_ALIGN (desttype) || src_align < TYPE_ALIGN (srctype)) return NULL_TREE; *************** expand_builtin_memory_chk (tree exp, rtx *** 11696,11703 **** return NULL_RTX; else { ! unsigned int dest_align ! = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); /* If DEST is not a pointer type, call the normal function. */ if (dest_align == 0) --- 11684,11690 ---- return NULL_RTX; else { ! unsigned int dest_align = get_pointer_alignment (dest); /* If DEST is not a pointer type, call the normal function. */ if (dest_align == 0) *************** expand_builtin_memory_chk (tree exp, rtx *** 11722,11729 **** /* __memmove_chk special case. */ if (fcode == BUILT_IN_MEMMOVE_CHK) { ! unsigned int src_align ! = get_pointer_alignment (src, BIGGEST_ALIGNMENT); if (src_align == 0) return NULL_RTX; --- 11709,11715 ---- /* __memmove_chk special case. */ if (fcode == BUILT_IN_MEMMOVE_CHK) { ! unsigned int src_align = get_pointer_alignment (src); if (src_align == 0) return NULL_RTX; Index: gcc/emit-rtl.c =================================================================== *** gcc/emit-rtl.c.orig 2011-08-04 12:59:41.000000000 +0200 --- gcc/emit-rtl.c 2011-08-10 11:26:02.000000000 +0200 *************** get_mem_align_offset (rtx mem, unsigned *** 1466,1472 **** /* This function can't use if (!MEM_EXPR (mem) || !MEM_OFFSET_KNOWN_P (mem) || (MAX (MEM_ALIGN (mem), ! get_object_alignment (MEM_EXPR (mem), align)) < align)) return -1; else --- 1466,1472 ---- /* This function can't use if (!MEM_EXPR (mem) || !MEM_OFFSET_KNOWN_P (mem) || (MAX (MEM_ALIGN (mem), ! MAX (align, get_object_alignment (MEM_EXPR (mem)))) < align)) return -1; else *************** set_mem_attributes_minus_bitpos (rtx ref *** 1826,1834 **** apply_bitpos = bitpos; } ! if (!align_computed && !INDIRECT_REF_P (t)) { ! unsigned int obj_align = get_object_alignment (t, BIGGEST_ALIGNMENT); attrs.align = MAX (attrs.align, obj_align); } } --- 1826,1834 ---- apply_bitpos = bitpos; } ! if (!align_computed) { ! unsigned int obj_align = get_object_alignment (t); attrs.align = MAX (attrs.align, obj_align); } } Index: gcc/expr.c =================================================================== *** gcc/expr.c.orig 2011-08-08 11:05:31.000000000 +0200 --- gcc/expr.c 2011-08-10 11:26:42.000000000 +0200 *************** expand_assignment (tree to, tree from, b *** 4440,4447 **** if ((TREE_CODE (to) == MEM_REF || TREE_CODE (to) == TARGET_MEM_REF) && mode != BLKmode ! && ((align = MAX (TYPE_ALIGN (TREE_TYPE (to)), ! get_object_alignment (to, BIGGEST_ALIGNMENT))) < (signed) GET_MODE_ALIGNMENT (mode)) && ((icode = optab_handler (movmisalign_optab, mode)) != CODE_FOR_nothing)) --- 4440,4446 ---- if ((TREE_CODE (to) == MEM_REF || TREE_CODE (to) == TARGET_MEM_REF) && mode != BLKmode ! && ((align = MAX (TYPE_ALIGN (TREE_TYPE (to)), get_object_alignment (to))) < (signed) GET_MODE_ALIGNMENT (mode)) && ((icode = optab_handler (movmisalign_optab, mode)) != CODE_FOR_nothing)) *************** expand_expr_real_1 (tree exp, rtx target *** 9046,9053 **** temp = gen_rtx_MEM (mode, op0); set_mem_attributes (temp, exp, 0); set_mem_addr_space (temp, as); ! align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), ! get_object_alignment (exp, BIGGEST_ALIGNMENT)); if (mode != BLKmode && (unsigned) align < GET_MODE_ALIGNMENT (mode) /* If the target does not have special handling for unaligned --- 9045,9051 ---- temp = gen_rtx_MEM (mode, op0); set_mem_attributes (temp, exp, 0); set_mem_addr_space (temp, as); ! align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), get_object_alignment (exp)); if (mode != BLKmode && (unsigned) align < GET_MODE_ALIGNMENT (mode) /* If the target does not have special handling for unaligned *************** expand_expr_real_1 (tree exp, rtx target *** 9127,9134 **** gimple_assign_rhs1 (def_stmt), mask); TREE_OPERAND (exp, 0) = base; } ! align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), ! get_object_alignment (exp, BIGGEST_ALIGNMENT)); op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_SUM); op0 = memory_address_addr_space (address_mode, op0, as); if (!integer_zerop (TREE_OPERAND (exp, 1))) --- 9125,9131 ---- gimple_assign_rhs1 (def_stmt), mask); TREE_OPERAND (exp, 0) = base; } ! align = MAX (TYPE_ALIGN (TREE_TYPE (exp)), get_object_alignment (exp)); op0 = expand_expr (base, NULL_RTX, VOIDmode, EXPAND_SUM); op0 = memory_address_addr_space (address_mode, op0, as); if (!integer_zerop (TREE_OPERAND (exp, 1))) Index: gcc/tree-sra.c =================================================================== *** gcc/tree-sra.c.orig 2011-08-09 15:46:07.000000000 +0200 --- gcc/tree-sra.c 2011-08-10 11:27:07.000000000 +0200 *************** tree_non_mode_aligned_mem_p (tree exp) *** 1085,1091 **** || !STRICT_ALIGNMENT) return false; ! align = get_object_alignment (exp, BIGGEST_ALIGNMENT); if (GET_MODE_ALIGNMENT (mode) > align) return true; --- 1085,1091 ---- || !STRICT_ALIGNMENT) return false; ! align = get_object_alignment (exp); if (GET_MODE_ALIGNMENT (mode) > align) return true; Index: gcc/tree-ssa-forwprop.c =================================================================== *** gcc/tree-ssa-forwprop.c.orig 2011-08-04 12:59:41.000000000 +0200 --- gcc/tree-ssa-forwprop.c 2011-08-10 11:30:07.000000000 +0200 *************** simplify_builtin_call (gimple_stmt_itera *** 1509,1515 **** || use_stmt != stmt2)) break; ! ptr1_align = get_pointer_alignment (ptr1, BIGGEST_ALIGNMENT); /* Construct the new source string literal. */ src_buf = XALLOCAVEC (char, src_len + 1); if (callee1) --- 1509,1515 ---- || use_stmt != stmt2)) break; ! ptr1_align = get_pointer_alignment (ptr1); /* Construct the new source string literal. */ src_buf = XALLOCAVEC (char, src_len + 1); if (callee1) Index: gcc/tree-ssa-loop-ivopts.c =================================================================== *** gcc/tree-ssa-loop-ivopts.c.orig 2011-08-01 10:13:00.000000000 +0200 --- gcc/tree-ssa-loop-ivopts.c 2011-08-10 11:27:25.000000000 +0200 *************** may_be_unaligned_p (tree ref, tree step) *** 1635,1641 **** base = get_inner_reference (ref, &bitsize, &bitpos, &toffset, &mode, &unsignedp, &volatilep, true); base_type = TREE_TYPE (base); ! base_align = get_object_alignment (base, BIGGEST_ALIGNMENT); base_align = MAX (base_align, TYPE_ALIGN (base_type)); if (mode != BLKmode) --- 1635,1641 ---- base = get_inner_reference (ref, &bitsize, &bitpos, &toffset, &mode, &unsignedp, &volatilep, true); base_type = TREE_TYPE (base); ! base_align = get_object_alignment (base); base_align = MAX (base_align, TYPE_ALIGN (base_type)); if (mode != BLKmode) Index: gcc/tree-vect-data-refs.c =================================================================== *** gcc/tree-vect-data-refs.c.orig 2011-07-19 16:02:24.000000000 +0200 --- gcc/tree-vect-data-refs.c 2011-08-10 11:30:22.000000000 +0200 *************** vect_compute_data_ref_alignment (struct *** 860,867 **** && tree_int_cst_compare (ssize_int (TYPE_ALIGN_UNIT (TREE_TYPE ( TREE_TYPE (base_addr)))), alignment) >= 0) ! || (get_pointer_alignment (base_addr, TYPE_ALIGN (vectype)) ! >= TYPE_ALIGN (vectype))) base_aligned = true; else base_aligned = false; --- 860,866 ---- && tree_int_cst_compare (ssize_int (TYPE_ALIGN_UNIT (TREE_TYPE ( TREE_TYPE (base_addr)))), alignment) >= 0) ! || (get_pointer_alignment (base_addr) >= TYPE_ALIGN (vectype))) base_aligned = true; else base_aligned = false; Index: gcc/value-prof.c =================================================================== *** gcc/value-prof.c.orig 2011-07-11 17:02:51.000000000 +0200 --- gcc/value-prof.c 2011-08-10 11:30:34.000000000 +0200 *************** gimple_stringops_transform (gimple_stmt_ *** 1528,1540 **** else prob = 0; dest = gimple_call_arg (stmt, 0); ! dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); switch (fcode) { case BUILT_IN_MEMCPY: case BUILT_IN_MEMPCPY: src = gimple_call_arg (stmt, 1); ! src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT); if (!can_move_by_pieces (val, MIN (dest_align, src_align))) return false; break; --- 1528,1540 ---- else prob = 0; dest = gimple_call_arg (stmt, 0); ! dest_align = get_pointer_alignment (dest); switch (fcode) { case BUILT_IN_MEMCPY: case BUILT_IN_MEMPCPY: src = gimple_call_arg (stmt, 1); ! src_align = get_pointer_alignment (src); if (!can_move_by_pieces (val, MIN (dest_align, src_align))) return false; break;