diff options
author | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-21 19:27:00 +0000 |
---|---|---|
committer | dberlin <dberlin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-21 19:27:00 +0000 |
commit | af0ecff34e2b6e3a50642dc00cd2c2e7a7c1523a (patch) | |
tree | fa074c6a524b35099d5e619373b0066febd064c9 /gcc/tree-flow-inline.h | |
parent | a337a40424b4b722262682dd553870403386eaec (diff) | |
download | gcc-af0ecff34e2b6e3a50642dc00cd2c2e7a7c1523a.tar.gz |
2005-03-18 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/20542
* tree-flow-inline.h (overlap_subvar): Move to here.
* tree-ssa-operands.c: From here.
* tree-flow.h (overlap_subvar): Declare.
* tree-ssa-alias.c (add_pointed_to_var): Use overlap_subvar here.
* tree-ssa-loop-im.c (is_call_clobbered_ref): Return proper answer
for variables with subvars.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96829 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r-- | gcc/tree-flow-inline.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 2d29eb2ff13..4d6f5cb1485 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -933,5 +933,48 @@ var_can_have_subvars (tree v) } +/* Return true if OFFSET and SIZE define a range that overlaps with some + portion of the range of SV, a subvar. If there was an exact overlap, + *EXACT will be set to true upon return. */ + +static inline bool +overlap_subvar (HOST_WIDE_INT offset, HOST_WIDE_INT size, + subvar_t sv, bool *exact) +{ + /* There are three possible cases of overlap. + 1. We can have an exact overlap, like so: + |offset, offset + size | + |sv->offset, sv->offset + sv->size | + + 2. We can have offset starting after sv->offset, like so: + + |offset, offset + size | + |sv->offset, sv->offset + sv->size | + + 3. We can have offset starting before sv->offset, like so: + + |offset, offset + size | + |sv->offset, sv->offset + sv->size| + */ + + if (exact) + *exact = false; + if (offset == sv->offset && size == sv->size) + { + if (exact) + *exact = true; + return true; + } + else if (offset >= sv->offset && offset < (sv->offset + sv->size)) + { + return true; + } + else if (offset < sv->offset && (offset + size > sv->offset)) + { + return true; + } + return false; + +} #endif /* _TREE_FLOW_INLINE_H */ |