Makefile.in (OBJS): Remove loop-unswitch.o.

2014-04-23  Richard Biener  <rguenther@suse.de>

	* Makefile.in (OBJS): Remove loop-unswitch.o.
	* loop-unswitch.c: Delete.
	* tree-pass.h (make_pass_rtl_unswitch): Remove.
	* passes.def (pass_rtl_unswitch): Likewise.
	* loop-init.c (gate_rtl_unswitch): Likewise.
	(rtl_unswitch): Likewise.
	(pass_data_rtl_unswitch): Likewise.
	(pass_rtl_unswitch): Likewise.
	(make_pass_rtl_unswitch): Likewise.
	* rtl.h (reversed_condition): Likewise.
	(compare_and_jump_seq): Likewise.
	* loop-iv.c (reversed_condition): Move here from loop-unswitch.c
	and make static.
	* loop-unroll.c (compare_and_jump_seq): Likewise.

From-SVN: r209698
This commit is contained in:
Richard Biener 2014-04-23 13:48:12 +00:00 committed by Richard Biener
parent 22718afe53
commit da4cfeacb0
8 changed files with 85 additions and 50 deletions

View File

@ -1,3 +1,20 @@
2014-04-23 Richard Biener <rguenther@suse.de>
* Makefile.in (OBJS): Remove loop-unswitch.o.
* loop-unswitch.c: Delete.
* tree-pass.h (make_pass_rtl_unswitch): Remove.
* passes.def (pass_rtl_unswitch): Likewise.
* loop-init.c (gate_rtl_unswitch): Likewise.
(rtl_unswitch): Likewise.
(pass_data_rtl_unswitch): Likewise.
(pass_rtl_unswitch): Likewise.
(make_pass_rtl_unswitch): Likewise.
* rtl.h (reversed_condition): Likewise.
(compare_and_jump_seq): Likewise.
* loop-iv.c (reversed_condition): Move here from loop-unswitch.c
and make static.
* loop-unroll.c (compare_and_jump_seq): Likewise.
2014-04-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/60903

View File

@ -1294,7 +1294,6 @@ OBJS = \
loop-invariant.o \
loop-iv.o \
loop-unroll.o \
loop-unswitch.o \
lower-subreg.o \
lra.o \
lra-assigns.o \

View File

@ -511,49 +511,6 @@ make_pass_rtl_move_loop_invariants (gcc::context *ctxt)
namespace {
const pass_data pass_data_rtl_unswitch =
{
RTL_PASS, /* type */
"loop2_unswitch", /* name */
OPTGROUP_LOOP, /* optinfo_flags */
true, /* has_execute */
TV_LOOP_UNSWITCH, /* tv_id */
0, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_verify_rtl_sharing, /* todo_flags_finish */
};
class pass_rtl_unswitch : public rtl_opt_pass
{
public:
pass_rtl_unswitch (gcc::context *ctxt)
: rtl_opt_pass (pass_data_rtl_unswitch, ctxt)
{}
/* opt_pass methods: */
virtual bool gate (function *) { return flag_unswitch_loops; }
virtual unsigned int execute (function *fun)
{
if (number_of_loops (fun) > 1)
unswitch_loops ();
return 0;
}
}; // class pass_rtl_unswitch
} // anon namespace
rtl_opt_pass *
make_pass_rtl_unswitch (gcc::context *ctxt)
{
return new pass_rtl_unswitch (ctxt);
}
namespace {
const pass_data pass_data_rtl_unroll_and_peel_loops =
{
RTL_PASS, /* type */

View File

@ -1732,6 +1732,21 @@ canon_condition (rtx cond)
return cond;
}
/* Reverses CONDition; returns NULL if we cannot. */
static rtx
reversed_condition (rtx cond)
{
enum rtx_code reversed;
reversed = reversed_comparison_code (cond, NULL);
if (reversed == UNKNOWN)
return NULL_RTX;
else
return gen_rtx_fmt_ee (reversed,
GET_MODE (cond), XEXP (cond, 0),
XEXP (cond, 1));
}
/* Tries to use the fact that COND holds to simplify EXPR. ALTERED is the
set of altered regs. */

View File

@ -1060,6 +1060,59 @@ split_edge_and_insert (edge e, rtx insns)
return bb;
}
/* Prepare a sequence comparing OP0 with OP1 using COMP and jumping to LABEL if
true, with probability PROB. If CINSN is not NULL, it is the insn to copy
in order to create a jump. */
static rtx
compare_and_jump_seq (rtx op0, rtx op1, enum rtx_code comp, rtx label, int prob,
rtx cinsn)
{
rtx seq, jump, cond;
enum machine_mode mode;
mode = GET_MODE (op0);
if (mode == VOIDmode)
mode = GET_MODE (op1);
start_sequence ();
if (GET_MODE_CLASS (mode) == MODE_CC)
{
/* A hack -- there seems to be no easy generic way how to make a
conditional jump from a ccmode comparison. */
gcc_assert (cinsn);
cond = XEXP (SET_SRC (pc_set (cinsn)), 0);
gcc_assert (GET_CODE (cond) == comp);
gcc_assert (rtx_equal_p (op0, XEXP (cond, 0)));
gcc_assert (rtx_equal_p (op1, XEXP (cond, 1)));
emit_jump_insn (copy_insn (PATTERN (cinsn)));
jump = get_last_insn ();
gcc_assert (JUMP_P (jump));
JUMP_LABEL (jump) = JUMP_LABEL (cinsn);
LABEL_NUSES (JUMP_LABEL (jump))++;
redirect_jump (jump, label, 0);
}
else
{
gcc_assert (!cinsn);
op0 = force_operand (op0, NULL_RTX);
op1 = force_operand (op1, NULL_RTX);
do_compare_rtx_and_jump (op0, op1, comp, 0,
mode, NULL_RTX, NULL_RTX, label, -1);
jump = get_last_insn ();
gcc_assert (JUMP_P (jump));
JUMP_LABEL (jump) = label;
LABEL_NUSES (label)++;
}
add_int_reg_note (jump, REG_BR_PROB, prob);
seq = get_insns ();
end_sequence ();
return seq;
}
/* Unroll LOOP for which we are able to count number of iterations in runtime
LOOP->LPT_DECISION.TIMES times. The transformation does this (with some
extra care for case n < 0):

View File

@ -341,7 +341,6 @@ along with GCC; see the file COPYING3. If not see
PUSH_INSERT_PASSES_WITHIN (pass_loop2)
NEXT_PASS (pass_rtl_loop_init);
NEXT_PASS (pass_rtl_move_loop_invariants);
NEXT_PASS (pass_rtl_unswitch);
NEXT_PASS (pass_rtl_unroll_and_peel_loops);
NEXT_PASS (pass_rtl_doloop);
NEXT_PASS (pass_rtl_loop_done);

View File

@ -2743,10 +2743,6 @@ extern unsigned int variable_tracking_main (void);
extern void get_mode_bounds (enum machine_mode, int, enum machine_mode,
rtx *, rtx *);
/* In loop-unswitch.c */
extern rtx reversed_condition (rtx);
extern rtx compare_and_jump_seq (rtx, rtx, enum rtx_code, rtx, int, rtx);
/* In loop-iv.c */
extern rtx canon_condition (rtx);
extern void simplify_using_condition (rtx, rtx *, bitmap);

View File

@ -509,7 +509,6 @@ extern rtl_opt_pass *make_pass_outof_cfg_layout_mode (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_loop2 (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_rtl_loop_init (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_rtl_move_loop_invariants (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_rtl_unswitch (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_rtl_unroll_and_peel_loops (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_rtl_doloop (gcc::context *ctxt);
extern rtl_opt_pass *make_pass_rtl_loop_done (gcc::context *ctxt);