loop.c (maybe_eliminate_biv): For libcalls that set a giv, skip to end of libcall.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Mon, 29 Mar 1999 11:56:45 +0000 (11:56 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Mon, 29 Mar 1999 11:56:45 +0000 (12:56 +0100)
* loop.c (maybe_eliminate_biv): For libcalls that set a giv, skip to
end of libcall.

From-SVN: r26056

gcc/ChangeLog
gcc/loop.c

index c0461f4629b78adc7c17b226b671542b0727adf6..bc49772d04fd134dcec3b2f81d4b1762f4b4d49b 100644 (file)
@@ -1,3 +1,8 @@
+Mon Mar 29 20:52:47 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * loop.c (maybe_eliminate_biv): For libcalls that set a giv, skip to
+       end of libcall.
+
 Mon Mar 29 20:35:49 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * sh.md (mulsi3): Tag an extra REG_EQUAL note to the middle insn.
index 7b6ec8de6e28ca4a45ff6d6da362d923a581214b..a626784a02a4b2670f4ff4c4a7b9e84346a0edea 100644 (file)
@@ -8121,6 +8121,26 @@ maybe_eliminate_biv (bl, loop_start, end, eliminate_p, threshold, insn_count)
       enum rtx_code code = GET_CODE (p);
       rtx where = threshold >= insn_count ? loop_start : p;
 
+      /* If this is a libcall that sets a giv, skip ahead to its end.  */
+      if (GET_RTX_CLASS (code) == 'i')
+       {
+         rtx note = find_reg_note (p, REG_LIBCALL, NULL_RTX);
+
+         if (note)
+           {
+             rtx last = XEXP (note, 0);
+             rtx set = single_set (last);
+
+             if (set && GET_CODE (SET_DEST (set)) == REG)
+               {
+                 int regno = REGNO (SET_DEST (set));
+
+                 if (REG_IV_TYPE (regno) == GENERAL_INDUCT
+                     && REG_IV_INFO (regno)->src_reg == bl->biv->src_reg)
+                   p = last;
+               }
+           }
+       }
       if ((code == INSN || code == JUMP_INSN || code == CALL_INSN)
          && reg_mentioned_p (reg, PATTERN (p))
          && ! maybe_eliminate_biv_1 (PATTERN (p), p, bl, eliminate_p, where))