diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2006-06-21 15:09:36 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2006-06-21 15:09:36 +0000 |
commit | 75715cf63280063d539869489ad0f18e0ad1a1fa (patch) | |
tree | e69f3c4f2aa88e84c047225360cea409efb14f51 /gcc/tree-ssa-loop-ivopts.c | |
parent | 18fc9bd4937d19dbb7f7fbbd3299339fcb57156f (diff) | |
download | gcc-75715cf63280063d539869489ad0f18e0ad1a1fa.zip gcc-75715cf63280063d539869489ad0f18e0ad1a1fa.tar.gz gcc-75715cf63280063d539869489ad0f18e0ad1a1fa.tar.bz2 |
tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): New function.
* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): New function.
(find_interesting_uses_address): Punt if above function returns true.
From-SVN: r114851
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 0f98604..8a69664 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -1466,6 +1466,36 @@ may_be_unaligned_p (tree ref) return false; } +/* Return true if EXPR may be non-addressable. */ + +static bool +may_be_nonaddressable_p (tree expr) +{ + switch (TREE_CODE (expr)) + { + case COMPONENT_REF: + return DECL_NONADDRESSABLE_P (TREE_OPERAND (expr, 1)) + || may_be_nonaddressable_p (TREE_OPERAND (expr, 0)); + + case ARRAY_REF: + case ARRAY_RANGE_REF: + return may_be_nonaddressable_p (TREE_OPERAND (expr, 0)); + + case VIEW_CONVERT_EXPR: + /* This kind of view-conversions may wrap non-addressable objects + and make them look addressable. After some processing the + non-addressability may be uncovered again, causing ADDR_EXPRs + of inappropriate objects to be built. */ + return AGGREGATE_TYPE_P (TREE_TYPE (expr)) + && !AGGREGATE_TYPE_P (TREE_TYPE (TREE_OPERAND (expr, 0))); + + default: + break; + } + + return false; +} + /* Finds addresses in *OP_P inside STMT. */ static void @@ -1482,9 +1512,10 @@ find_interesting_uses_address (struct ivopts_data *data, tree stmt, tree *op_p) /* Ignore bitfields for now. Not really something terribly complicated to handle. TODO. */ - if (TREE_CODE (base) == BIT_FIELD_REF - || (TREE_CODE (base) == COMPONENT_REF - && DECL_NONADDRESSABLE_P (TREE_OPERAND (base, 1)))) + if (TREE_CODE (base) == BIT_FIELD_REF) + goto fail; + + if (may_be_nonaddressable_p (base)) goto fail; if (STRICT_ALIGNMENT |