summaryrefslogtreecommitdiff
path: root/gcc/tree-flow-inline.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r--gcc/tree-flow-inline.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index d8b57a556af..e31db442a5d 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -1407,32 +1407,34 @@ unmodifiable_var_p (tree var)
return TREE_READONLY (var) && (TREE_STATIC (var) || DECL_EXTERNAL (var));
}
-/* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in
- it. */
+/* Return true if REF, an ARRAY_REF, has an INDIRECT_REF somewhere in it. */
static inline bool
-ref_contains_indirect_ref (tree ref)
+array_ref_contains_indirect_ref (tree ref)
{
- while (handled_component_p (ref))
- {
- if (TREE_CODE (ref) == INDIRECT_REF)
- return true;
- ref = TREE_OPERAND (ref, 0);
- }
- return false;
+ gcc_assert (TREE_CODE (ref) == ARRAY_REF);
+
+ do {
+ ref = TREE_OPERAND (ref, 0);
+ } while (handled_component_p (ref));
+
+ return TREE_CODE (ref) == INDIRECT_REF;
}
-/* Return true if REF, a COMPONENT_REF, has an ARRAY_REF somewhere in it. */
+/* Return true if REF, a handled component reference, has an ARRAY_REF
+ somewhere in it. */
static inline bool
ref_contains_array_ref (tree ref)
{
- while (handled_component_p (ref))
- {
- if (TREE_CODE (ref) == ARRAY_REF)
- return true;
- ref = TREE_OPERAND (ref, 0);
- }
+ gcc_assert (handled_component_p (ref));
+
+ do {
+ if (TREE_CODE (ref) == ARRAY_REF)
+ return true;
+ ref = TREE_OPERAND (ref, 0);
+ } while (handled_component_p (ref));
+
return false;
}