summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-23 13:48:12 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-23 13:48:12 +0000
commitb99ab2752f0adc47b0606cc3ca31696172bbe36c (patch)
tree74c8ed6896fc763ca39ad07ae90e5c2c28f4727d /gcc
parenta1ccf30d77f65e6b6ae857f18bdbcbb7f996b10e (diff)
downloadgcc-b99ab2752f0adc47b0606cc3ca31696172bbe36c.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog17
-rw-r--r--gcc/Makefile.in1
-rw-r--r--gcc/loop-init.c43
-rw-r--r--gcc/loop-iv.c15
-rw-r--r--gcc/loop-unroll.c53
-rw-r--r--gcc/passes.def1
-rw-r--r--gcc/rtl.h4
-rw-r--r--gcc/tree-pass.h1
8 files changed, 85 insertions, 50 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0a6cb55e942..c79f26ab7fc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,22 @@
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
* tree-ssa-loop-im.c (analyze_memory_references): Remove
commented code block.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index d1ab22f1902..6b46408d1a1 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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 \
diff --git a/gcc/loop-init.c b/gcc/loop-init.c
index 59f52d0f29b..b7f8d9c68c5 100644
--- a/gcc/loop-init.c
+++ b/gcc/loop-init.c
@@ -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 */
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index 9091220642c..42bcb75bec7 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -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. */
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 4561ce8cb71..f952d9d1ea3 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -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):
diff --git a/gcc/passes.def b/gcc/passes.def
index 1ecfb713226..506b65789f6 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -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);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index f1cda4c04b5..3a526a1dd66 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -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);
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index e63f3069068..46dc00c38a3 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -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);