aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2010-04-30 21:10:53 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-04-30 21:10:53 +0000
commitce276b614cde941ac9bbc481e7ffd29e5e53b74d (patch)
tree8b95fc1b108384f4752ddbc500a0c367f241fee9 /gcc/tree-ssa-loop-ivopts.c
parent5cb6410a270421888033a4489c9f46d979324877 (diff)
downloadgcc-ce276b614cde941ac9bbc481e7ffd29e5e53b74d.zip
gcc-ce276b614cde941ac9bbc481e7ffd29e5e53b74d.tar.gz
gcc-ce276b614cde941ac9bbc481e7ffd29e5e53b74d.tar.bz2
tree-ssa-loop-ivopts.c (may_be_unaligned_p): Check the alignment of the variable part of the offset as well.
* tree-ssa-loop-ivopts.c (may_be_unaligned_p): Check the alignment of the variable part of the offset as well. Use highest_pow2_factor for all alignment checks. From-SVN: r158948
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index a1fdfa4..8662f4c 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1536,16 +1536,18 @@ may_be_unaligned_p (tree ref, tree step)
if (mode != BLKmode)
{
- double_int mul;
- tree al = build_int_cst (TREE_TYPE (step),
- GET_MODE_ALIGNMENT (mode) / BITS_PER_UNIT);
+ unsigned mode_align = GET_MODE_ALIGNMENT (mode);
- if (base_align < GET_MODE_ALIGNMENT (mode)
- || bitpos % GET_MODE_ALIGNMENT (mode) != 0
- || bitpos % BITS_PER_UNIT != 0)
+ if (base_align < mode_align
+ || (bitpos % mode_align) != 0
+ || (bitpos % BITS_PER_UNIT) != 0)
return true;
- if (!constant_multiple_of (step, al, &mul))
+ if (toffset
+ && (highest_pow2_factor (toffset) * BITS_PER_UNIT) < mode_align)
+ return true;
+
+ if ((highest_pow2_factor (step) * BITS_PER_UNIT) < mode_align)
return true;
}