diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-06 09:40:39 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-06 09:40:39 +0000 |
commit | bf9fa95143f8a2e0df74e3a123ba8fff9d150672 (patch) | |
tree | bc642906a5611c9c79b776a27c3c99108e3223ec /gcc/loop-iv.c | |
parent | 15f1f1a4cefbec9f5a817e5888f01c2e57dc400b (diff) | |
download | gcc-bf9fa95143f8a2e0df74e3a123ba8fff9d150672.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85634 138bc75d-0d04-0410-961f-82ee72b054a4
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 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; |