summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-21 15:09:36 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-21 15:09:36 +0000
commit8ee578c81f0240a72ab314c0bfb3021ca8a2043f (patch)
treee69f3c4f2aa88e84c047225360cea409efb14f51 /gcc/tree-ssa-loop-ivopts.c
parentb1ef404ea216e235be327738d7b6bdccf9788d73 (diff)
downloadgcc-8ee578c81f0240a72ab314c0bfb3021ca8a2043f.tar.gz
* tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): New function.
(find_interesting_uses_address): Punt if above function returns true. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 0f98604a212..8a69664ba05 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