From: Zdenek Dvorak Date: Fri, 6 Aug 2004 09:40:39 +0000 (+0200) Subject: re PR tree-optimization/16807 ([lno] Weird loop unrolling) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6797f908eec82d7ead4ca65eb970868c7489f244;p=gcc.git re PR tree-optimization/16807 ([lno] Weird loop unrolling) PR tree-optimization/16807 * loop-iv.c (dump_iv_info): Dump invariants correctly. (iv_subreg, iv_extend): Express value of invariant purely in base field. From-SVN: r85634 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 53bfd1f46e3..d83bdbe2e66 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-08-06 Zdenek Dvorak + + PR tree-optimization/16807 + * loop-iv.c (dump_iv_info): Dump invariants correctly. + (iv_subreg, iv_extend): Express value of invariant purely in + base field. + 2004-08-06 Mark Mitchell * config/arm/symbian.h (CC1_SPEC): Add -fno-short-enums. diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 5feb0504312..0a01f86cb43 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -104,17 +104,17 @@ dump_iv_info (FILE *file, struct rtx_iv *iv) return; } - if (iv->step == const0_rtx) - { - fprintf (file, "invariant "); - print_rtl (file, iv->base); - return; - } + if (iv->step == const0_rtx + && !iv->first_special) + fprintf (file, "invariant "); print_rtl (file, iv->base); - fprintf (file, " + "); - print_rtl (file, iv->step); - fprintf (file, " * iteration"); + if (iv->step != const0_rtx) + { + fprintf (file, " + "); + print_rtl (file, iv->step); + fprintf (file, " * iteration"); + } fprintf (file, " (in %s)", GET_MODE_NAME (iv->mode)); if (iv->mode != iv->extend_mode) @@ -440,6 +440,21 @@ iv_constant (struct rtx_iv *iv, rtx cst, enum machine_mode mode) static bool iv_subreg (struct rtx_iv *iv, enum machine_mode mode) { + /* If iv is invariant, just calculate the new value. */ + if (iv->step == const0_rtx + && !iv->first_special) + { + rtx val = get_iv_value (iv, const0_rtx); + val = lowpart_subreg (mode, val, iv->extend_mode); + + iv->base = val; + iv->extend = NIL; + iv->mode = iv->extend_mode = mode; + iv->delta = const0_rtx; + iv->mult = const1_rtx; + return true; + } + if (iv->extend_mode == mode) return true; @@ -465,6 +480,21 @@ iv_subreg (struct rtx_iv *iv, enum machine_mode mode) static bool iv_extend (struct rtx_iv *iv, enum rtx_code extend, enum machine_mode mode) { + /* If iv is invariant, just calculate the new value. */ + if (iv->step == const0_rtx + && !iv->first_special) + { + rtx val = get_iv_value (iv, const0_rtx); + val = simplify_gen_unary (extend, mode, val, iv->extend_mode); + + iv->base = val; + iv->extend = NIL; + iv->mode = iv->extend_mode = mode; + iv->delta = const0_rtx; + iv->mult = const1_rtx; + return true; + } + if (mode != iv->extend_mode) return false;