diff options
author | Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> | 2004-08-06 11:40:39 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2004-08-06 09:40:39 +0000 |
commit | 6797f908eec82d7ead4ca65eb970868c7489f244 (patch) | |
tree | bc642906a5611c9c79b776a27c3c99108e3223ec /gcc/loop-iv.c | |
parent | 866cf0373156f1a614d620522caef62a36b2b5e4 (diff) | |
download | gcc-6797f908eec82d7ead4ca65eb970868c7489f244.zip gcc-6797f908eec82d7ead4ca65eb970868c7489f244.tar.gz gcc-6797f908eec82d7ead4ca65eb970868c7489f244.tar.bz2 |
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
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r-- | gcc/loop-iv.c | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index 5feb050..0a01f86 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; |