OSDN Git Service

(loop_iterations): When computing comparison_value, use
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 1993 19:38:34 +0000 (19:38 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 1993 19:38:34 +0000 (19:38 +0000)
reg_set_p to identify instructions that modify it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4036 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/unroll.c

index b58066d..d93e3ba 100644 (file)
@@ -3039,14 +3039,19 @@ loop_iterations (loop_start, loop_end)
            break;
 
          else if (GET_RTX_CLASS (GET_CODE (insn)) == 'i'
-                  && (set = single_set (insn))
-                  && (SET_DEST (set) == comparison_value))
+                  && reg_set_p (comparison_value, insn))
            {
-             rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
-             if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST)
-               comparison_value = XEXP (note, 0);
+             /* We found the last insn before the loop that sets the register.
+                If it sets the entire register, and has a REG_EQUAL note,
+                then use the value of the REG_EQUAL note.  */
+             if ((set = single_set (insn))
+                 && (SET_DEST (set) == comparison_value))
+               {
+                 rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
 
+                 if (note && GET_CODE (XEXP (note, 0)) != EXPR_LIST)
+                   comparison_value = XEXP (note, 0);
+               }
              break;
            }
        }