diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-02-13 21:14:25 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-02-13 21:14:25 +0100 |
commit | 67b977ada8b0fece1138d67d2ebfbf2e9b030d01 (patch) | |
tree | 92fff594ec7c4d741447b264c4c072902ab2149e /gcc/cselib.c | |
parent | 4228697645ad64c45df3584669dd35d3fdcbda7f (diff) | |
download | gcc-67b977ada8b0fece1138d67d2ebfbf2e9b030d01.zip gcc-67b977ada8b0fece1138d67d2ebfbf2e9b030d01.tar.gz gcc-67b977ada8b0fece1138d67d2ebfbf2e9b030d01.tar.bz2 |
cselib.c (expand_loc): Return sp, fp, hfp or cfa base reg right away if seen.
* cselib.c (expand_loc): Return sp, fp, hfp or cfa base reg right
away if seen.
From-SVN: r184169
Diffstat (limited to 'gcc/cselib.c')
-rw-r--r-- | gcc/cselib.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cselib.c b/gcc/cselib.c index 456c875..7d3e4ca 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -1372,8 +1372,18 @@ expand_loc (struct elt_loc_list *p, struct expand_value_data *evd, unsigned int regno = UINT_MAX; struct elt_loc_list *p_in = p; - for (; p; p = p -> next) + for (; p; p = p->next) { + /* Return these right away to avoid returning stack pointer based + expressions for frame pointer and vice versa, which is something + that would confuse DSE. See the comment in cselib_expand_value_rtx_1 + for more details. */ + if (REG_P (p->loc) + && (REGNO (p->loc) == STACK_POINTER_REGNUM + || REGNO (p->loc) == FRAME_POINTER_REGNUM + || REGNO (p->loc) == HARD_FRAME_POINTER_REGNUM + || REGNO (p->loc) == cfa_base_preserved_regno)) + return p->loc; /* Avoid infinite recursion trying to expand a reg into a the same reg. */ if ((REG_P (p->loc)) |