This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/17387] Redundant instructions in loop optimization
- From: "rakdver at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Sep 2004 19:55:37 -0000
- Subject: [Bug rtl-optimization/17387] Redundant instructions in loop optimization
- References: <20040909235415.17387.hjl@lucon.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rakdver at gcc dot gnu dot org 2004-09-11 19:55 -------
ivopts gets rid of the extends once the record_bounds pass is enabled by the
following patch. The nonsensical "mov %eax, %eax" type moves however
still remain in the code.
Zdenek
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.45
diff -c -3 -p -r2.45 tree-optimize.c
*** tree-optimize.c 9 Sep 2004 20:53:36 -0000 2.45
--- tree-optimize.c 11 Sep 2004 19:44:56 -0000
*************** init_tree_optimization_passes (void)
*** 392,397 ****
--- 392,398 ----
NEXT_PASS (pass_loop_init);
NEXT_PASS (pass_lim);
NEXT_PASS (pass_iv_canon);
+ NEXT_PASS (pass_record_bounds);
NEXT_PASS (pass_if_conversion);
NEXT_PASS (pass_vectorize);
NEXT_PASS (pass_linear_transform);
Index: tree-pass.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-pass.h,v
retrieving revision 2.15
diff -c -3 -p -r2.15 tree-pass.h
*** tree-pass.h 9 Sep 2004 20:53:37 -0000 2.15
--- tree-pass.h 11 Sep 2004 19:44:56 -0000
*************** extern struct tree_opt_pass pass_loop;
*** 126,131 ****
--- 126,132 ----
extern struct tree_opt_pass pass_loop_init;
extern struct tree_opt_pass pass_lim;
extern struct tree_opt_pass pass_iv_canon;
+ extern struct tree_opt_pass pass_record_bounds;
extern struct tree_opt_pass pass_if_conversion;
extern struct tree_opt_pass pass_vectorize;
extern struct tree_opt_pass pass_complete_unroll;
Index: tree-ssa-loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop.c,v
retrieving revision 2.17
diff -c -3 -p -r2.17 tree-ssa-loop.c
*** tree-ssa-loop.c 8 Sep 2004 15:28:56 -0000 2.17
--- tree-ssa-loop.c 11 Sep 2004 19:44:57 -0000
*************** struct tree_opt_pass pass_iv_canon =
*** 263,268 ****
--- 263,297 ----
0 /* letter */
};
+ /* Record bounds on numbers of iterations of loops. */
+
+ static void
+ tree_ssa_loop_bounds (void)
+ {
+ if (!current_loops)
+ return;
+
+ estimate_numbers_of_iterations (current_loops);
+ scev_reset ();
+ }
+
+ struct tree_opt_pass pass_record_bounds =
+ {
+ "bounds", /* name */
+ NULL, /* gate */
+ tree_ssa_loop_bounds, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ 0 /* letter */
+ };
+
/* Complete unrolling of loops. */
static void
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17387