summaryrefslogtreecommitdiff
path: root/gcc/reload.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-15 17:42:43 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2003-12-15 17:42:43 +0000
commit821e1d0df41badda91cc92d865fa812c51f89bf9 (patch)
treea160396a81237e124ff088404cc470129c589b51 /gcc/reload.c
parent364c2f434b1055cf8455bccdbc9bb23f1b494b66 (diff)
downloadgcc-821e1d0df41badda91cc92d865fa812c51f89bf9.tar.gz
* reload.c (reg_overlap_mentioned_for_reload_p):
When looking at a PLUS in X, avoid spuriously returning nonzero when IN is a REG or another simple PLUS, or a MEM containing one. * loop.c (loop_invariant_p): Amend comment about where new registers might come from. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74638 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/reload.c')
-rw-r--r--gcc/reload.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/reload.c b/gcc/reload.c
index fe0f0474689..13f6900ce3d 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -6290,8 +6290,22 @@ reg_overlap_mentioned_for_reload_p (rtx x, rtx in)
|| GET_CODE (x) == CC0)
return reg_mentioned_p (x, in);
else if (GET_CODE (x) == PLUS)
- return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in)
- || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in));
+ {
+ /* We actually want to know if X is mentioned somewhere inside IN.
+ We must not say that (plus (sp) (const_int 124)) is in
+ (plus (sp) (const_int 64)), since that can lead to incorrect reload
+ allocation when spuriously changing a RELOAD_FOR_OUTPUT_ADDRESS
+ into a RELOAD_OTHER on behalf of another RELOAD_OTHER. */
+ while (GET_CODE (in) == MEM)
+ in = XEXP (in, 0);
+ if (GET_CODE (in) == REG)
+ return 0;
+ else if (GET_CODE (in) == PLUS)
+ return (reg_overlap_mentioned_for_reload_p (x, XEXP (in, 0))
+ || reg_overlap_mentioned_for_reload_p (x, XEXP (in, 1)));
+ else return (reg_overlap_mentioned_for_reload_p (XEXP (x, 0), in)
+ || reg_overlap_mentioned_for_reload_p (XEXP (x, 1), in));
+ }
else
abort ();