loop-iv.c (iv_number_of_iterations): Fix overflow check for loops that count down.
authorDale Johannesen <dalej@apple.com>
Wed, 31 Aug 2005 17:25:36 +0000 (17:25 +0000)
committerDale Johannesen <dalej@gcc.gnu.org>
Wed, 31 Aug 2005 17:25:36 +0000 (17:25 +0000)
2005-08-31  Dale Johannesen  <dalej@apple.com>

        * loop-iv.c (iv_number_of_iterations):  Fix overflow check for
        loops that count down.

From-SVN: r103689

gcc/ChangeLog
gcc/loop-iv.c

index 49812f2..5565815 100644 (file)
@@ -1,3 +1,8 @@
+2005-08-31  Dale Johannesen  <dalej@apple.com>
+
+       * loop-iv.c (iv_number_of_iterations):  Fix overflow check for
+       loops that count down.
+
 2005-08-31  Richard Henderson  <rth@redhat.com>
 
        PR rtl-opt/23601
index 7c7a5de..8e915a0 100644 (file)
@@ -2417,7 +2417,7 @@ iv_number_of_iterations (struct loop *loop, rtx insn, rtx condition,
          tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
          tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
 
-         bound = simplify_gen_binary (MINUS, mode, mode_mmin,
+         bound = simplify_gen_binary (PLUS, mode, mode_mmin,
                                       lowpart_subreg (mode, step, comp_mode));
          if (step_is_pow2)
            {