From 8f4e6cafdebdae2730db4650e5c97e19f21481b6 Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@redhat.com>
Date: Fri, 25 Apr 2003 10:43:58 -0700
Subject: [PATCH] re PR rtl-optimization/10315 ([powerpc] ICE: in extract_insn,
 at recog.c:2175)

        PR opt/10315
        * config/rs6000/rs6000.c (rs6000_emit_move): Only elide proper
        checks during reload; use validize_mem instead of adjust_address.

From-SVN: r66071
---
 gcc/ChangeLog              |  6 ++++++
 gcc/config/rs6000/rs6000.c | 25 +++++++++++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7d291ea971b9..2c378a824be3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-25  Richard  Henderson  <rth@redhat.com>
+
+        PR opt/10315 
+        * config/rs6000/rs6000.c (rs6000_emit_move): Only elide proper
+        checks during reload; use validize_mem instead of adjust_address.
+
 2003-04-26  Ben Elliston  <bje@wasabisystems.com>
 
 	* config/arm/arm.c (arm_adjust_cost): Correct logic that tests the
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 9f9c42ac1975..66e6e5205cf4 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -2851,16 +2851,15 @@ rs6000_emit_move (dest, source, mode)
 	}
     }
 
-  /* Handle the case where reload calls us with an invalid address;
-     and the case of CONSTANT_P_RTX.  */
-  if (!ALTIVEC_VECTOR_MODE (mode)
+  /* Handle the case where reload calls us with an invalid address.  */
+  if (reload_in_progress && mode == Pmode
       && (! general_operand (operands[1], mode)
-	  || ! nonimmediate_operand (operands[0], mode)
-	  || GET_CODE (operands[1]) == CONSTANT_P_RTX))
-    {
-      emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
-      return;
-    }
+	  || ! nonimmediate_operand (operands[0], mode)))
+    goto emit_set;
+
+  /* Handle the case of CONSTANT_P_RTX.  */
+  if (GET_CODE (operands[1]) == CONSTANT_P_RTX)
+    goto emit_set;
   
   /* FIXME:  In the long term, this switch statement should go away
      and be replaced by a sequence of tests based on things like
@@ -3088,13 +3087,11 @@ rs6000_emit_move (dest, source, mode)
   /* Above, we may have called force_const_mem which may have returned
      an invalid address.  If we can, fix this up; otherwise, reload will
      have to deal with it.  */
-  if (GET_CODE (operands[1]) == MEM
-      && ! memory_address_p (mode, XEXP (operands[1], 0))
-      && ! reload_in_progress)
-    operands[1] = adjust_address (operands[1], mode, 0);
+  if (GET_CODE (operands[1]) == MEM && ! reload_in_progress)
+    operands[1] = validize_mem (operands[1]);
 
+ emit_set:
   emit_insn (gen_rtx_SET (VOIDmode, operands[0], operands[1]));
-  return;
 }
 
 /* Initialize a variable CUM of type CUMULATIVE_ARGS
-- 
GitLab