diff options
author | Wei Guozhi <carrot@google.com> | 2012-09-17 21:14:45 +0000 |
---|---|---|
committer | Wei Guozhi <carrot@google.com> | 2012-09-17 21:14:45 +0000 |
commit | 167b5b991bf4260c0f2f3ee115019e44d8861c0c (patch) | |
tree | 0b3e927c6e16d61ddc4802a58f0abfef8a430913 | |
parent | 6db6ab10be25a21535557dc5ff7afd59e0fb0981 (diff) |
* cselib.c (expand_loc): Return sp, fp, hfp or cfa base reg rightgoogle/gcc-4_6_3-mobile
away if seen.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_6_3-mobile@191407 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog.google-4_6 | 9 | ||||
-rw-r--r-- | gcc/cselib.c | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog.google-4_6 b/gcc/ChangeLog.google-4_6 index f3603ac47f0..c0b4bea0dcf 100644 --- a/gcc/ChangeLog.google-4_6 +++ b/gcc/ChangeLog.google-4_6 @@ -1,3 +1,12 @@ +2012-09-17 Wei Guozhi <carrot@google.com> + + Backport from trunk + + 2012-02-13 Jakub Jelinek <jakub@redhat.com> + + * cselib.c (expand_loc): Return sp, fp, hfp or cfa base reg right + away if seen. + 2012-05-11 Han Shen <shenhan@google.com> Backported r187569 from branches/google/gcc-4_6. diff --git a/gcc/cselib.c b/gcc/cselib.c index a2fdef7dbe3..d060c274562 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -1237,8 +1237,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)) |