re PR rtl-optimization/8165 (builtin string functions SEGV on alpha-pc-linux-gnu...
authorRichard Henderson <rth@redhat.com>
Mon, 14 Oct 2002 18:16:07 +0000 (11:16 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 14 Oct 2002 18:16:07 +0000 (11:16 -0700)
        PR opt/8165
        * gcse.c (adjust_libcall_notes): Revert last change.
        * simplify-rtx.c (simplify_replace_rtx): Handle LO_SUM.

From-SVN: r58130

gcc/ChangeLog
gcc/gcse.c
gcc/simplify-rtx.c

index 0312c09199d47d2dad78b7eb88a0ad6f9855524f..8233cba8dedaaa8a1f2b92a8bd53b5c0efdd3bbc 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-14  Richard Henderson  <rth@redhat.com>
+
+       PR opt/8165
+       * gcse.c (adjust_libcall_notes): Revert last change.
+       * simplify-rtx.c (simplify_replace_rtx): Handle LO_SUM.
+
 2002-10-14  Andrew Haley  <aph@redhat.com>
 
        * tree-inline.c (remap_block): All local class initialization
index bdde90f4e0c2e8128fe092f32c90a4ea04d91885..bb738e2dd8f85a7dda03dcd4aa1ad126550dce4f 100644 (file)
@@ -4330,23 +4330,17 @@ do_local_cprop (x, insn, alter_jumps, libcall_sp)
 
 /* LIBCALL_SP is a zero-terminated array of insns at the end of a libcall;
    their REG_EQUAL notes need updating to reflect that OLDREG has been
-   replaced with NEWVAL in INSN.  Also update the REG_EQUAL notes in INSN.
-
-   Return true if all substitutions could be made.  */
-
+   replaced with NEWVAL in INSN.  Return true if all substitutions could
+   be made.  */
 static bool
 adjust_libcall_notes (oldreg, newval, insn, libcall_sp)
      rtx oldreg, newval, insn, *libcall_sp;
 {
-  rtx end, note;
-
-  note = find_reg_equal_equiv_note (insn);
-  if (note)
-    XEXP (note, 0) = replace_rtx (XEXP (note, 0), oldreg, newval);
+  rtx end;
 
   while ((end = *libcall_sp++))
     {
-      note = find_reg_equal_equiv_note (end);
+      rtx note = find_reg_equal_equiv_note (end);
 
       if (! note)
        continue;
index cd7e28b45c74c247d2df96f1f4c82cd8c6d6986e..3293f0b7c6b1c3200aabb19cef87a405a83192ea 100644 (file)
@@ -343,9 +343,22 @@ simplify_replace_rtx (x, old, new)
        return replace_equiv_address_nv (x,
                                         simplify_replace_rtx (XEXP (x, 0),
                                                               old, new));
+      else if (code == LO_SUM)
+       {
+         rtx op0 = simplify_replace_rtx (XEXP (x, 0), old, new);
+         rtx op1 = simplify_replace_rtx (XEXP (x, 1), old, new);
 
-      if (REG_P (x) && REG_P (old) && REGNO (x) == REGNO (old))
-       return new;
+         /* (lo_sum (high x) x) -> x  */
+         if (GET_CODE (op0) == HIGH && rtx_equal_p (XEXP (op0, 0), op1))
+           return op1;
+
+         return gen_rtx_LO_SUM (mode, op0, op1);
+       }
+      else if (code == REG)
+       {
+         if (REG_P (old) && REGNO (x) == REGNO (old))
+           return new;
+       }
 
       return x;