summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-14 12:07:57 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-14 12:07:57 +0000
commit0c883ef3de95b2304dcc490559cf646ff927d225 (patch)
tree8d1c24f7892e87a4ef9d15d2ffc7a8758db7b114 /gcc/fold-const.c
parentbd5ba09ffaca7ff99fa2dedc8bcfb504ec08ec5d (diff)
downloadgcc-0c883ef3de95b2304dcc490559cf646ff927d225.tar.gz
2011-04-14 Richard Guenther <rguenther@suse.de>
* tree.h (get_object_alignment_1): Declare. * builtins.c (get_object_alignment_1): Split out worker from ... (get_object_alignment): ... here. * fold-const.c (get_pointer_modulus_and_residue): Use get_object_alignment_1. * gcc.dg/fold-bitand-4.c: Move ... * c-c++-common/fold-bitand-4.c: ... here. Adjust slightly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c34
1 files changed, 7 insertions, 27 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 0c0420d043c..8d543c4080f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -9230,30 +9230,10 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue,
code = TREE_CODE (expr);
if (code == ADDR_EXPR)
{
- expr = TREE_OPERAND (expr, 0);
- if (handled_component_p (expr))
- {
- HOST_WIDE_INT bitsize, bitpos;
- tree offset;
- enum machine_mode mode;
- int unsignedp, volatilep;
-
- expr = get_inner_reference (expr, &bitsize, &bitpos, &offset,
- &mode, &unsignedp, &volatilep, false);
- *residue = bitpos / BITS_PER_UNIT;
- if (offset)
- {
- if (TREE_CODE (offset) == INTEGER_CST)
- *residue += TREE_INT_CST_LOW (offset);
- else
- /* We don't handle more complicated offset expressions. */
- return 1;
- }
- }
-
- if (DECL_P (expr)
- && (allow_func_align || TREE_CODE (expr) != FUNCTION_DECL))
- return DECL_ALIGN_UNIT (expr);
+ unsigned int bitalign;
+ bitalign = get_object_alignment_1 (TREE_OPERAND (expr, 0), residue);
+ *residue /= BITS_PER_UNIT;
+ return bitalign / BITS_PER_UNIT;
}
else if (code == POINTER_PLUS_EXPR)
{
@@ -9298,9 +9278,9 @@ get_pointer_modulus_and_residue (tree expr, unsigned HOST_WIDE_INT *residue,
}
}
- /* If we get here, we were unable to determine anything useful about the
- expression. */
- return 1;
+ /* If we get here, we were unable to determine anything useful about the
+ expression. */
+ return 1;
}