summaryrefslogtreecommitdiffstats
path: root/gcc/loop-unswitch.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-19 17:53:45 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-19 17:53:45 +0000
commita6629703d0608f506dfc32c20e017d6b0c6ce535 (patch)
tree0b36d07ee82475415ae29e4414267b5f3dd44411 /gcc/loop-unswitch.c
parenteab5d13fd725dbf52a0737d53de32ff952be5de6 (diff)
downloadppe42-gcc-a6629703d0608f506dfc32c20e017d6b0c6ce535.tar.gz
ppe42-gcc-a6629703d0608f506dfc32c20e017d6b0c6ce535.zip
PR c++/15463
* loop-iv.c (iv_number_of_iterations): Use trunc_int_for_mode on result of inverse. PR rtl-optimization/15274 * loop-iv.c (determine_max_iter, shorten_into_mode, iv_number_of_iterations): Handle constants correctly. * rtl.h (get_mode_bounds): Declaration changed. * stor-layout.c (get_mode_bounds): Return a constant suitable for the target mode. PR rtl-optimization/14692 * loop-unswitch.c (may_unswitch_on): Try folding the result. (unswitch_single_loop): Work correctly when may_unswitch_on returns a folded constant. * loop-iv.c (implies_p): Handle A < B ==> A + 1 <= B. * simplify-rtx.c (simplify_const_relational_operation): Optimize comparisons with mode bounds. * function.c (struct temp_slot): Add new field prev. (free_after_compilation, init_temp_slots): Free new fields. (cut_slot_from_list, insert_slot_to_list, temp_slots_at_level, max_slot_level, move_slot_to_level, make_slot_available): New functions. (assign_stack_temp_for_type, combine_temp_slots, find_temp_slot_from_address, preserve_temp_slots, preserve_rtl_expr_result, free_temp_slots, free_temps_for_rtl_expr, pop_temp_slots): Work with the new structure of lists. (mark_all_temps_used): Removed. * function.h (struct function): Field x_temp_slots replaced by x_used_temp_slots and x_avail_temp_slots. (temp_slots): Replaced by ... (used_temp_slots, avail_temp_slots): New. * tree.h (mark_all_temps_used): Declaration removed. * loop-iv.c (mark_single_set, get_biv_step_1, iv_analyze, simplify_using_assignment): Take the expression out of the expr_list wrapper. * loop-iv.c (iv_number_of_iterations): Improve clasification of infinite loops. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-unswitch.c')
-rw-r--r--gcc/loop-unswitch.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c
index bedf5f8ce7c..8f1f54f0d73 100644
--- a/gcc/loop-unswitch.c
+++ b/gcc/loop-unswitch.c
@@ -174,7 +174,7 @@ unswitch_loops (struct loops *loops)
static rtx
may_unswitch_on (basic_block bb, struct loop *loop, rtx *cinsn)
{
- rtx test, at, insn, op[2];
+ rtx test, at, insn, op[2], stest;
struct rtx_iv iv;
unsigned i;
enum machine_mode mode;
@@ -233,6 +233,12 @@ may_unswitch_on (basic_block bb, struct loop *loop, rtx *cinsn)
return test;
}
+ stest = simplify_gen_relational (GET_CODE (test), SImode,
+ mode, op[0], op[1]);
+ if (stest == const0_rtx
+ || stest == const_true_rtx)
+ return stest;
+
return canon_condition (gen_rtx_fmt_ee (GET_CODE (test), SImode,
op[0], op[1]));
}
@@ -262,7 +268,7 @@ unswitch_single_loop (struct loops *loops, struct loop *loop,
basic_block *bbs;
struct loop *nloop;
unsigned i;
- rtx cond, rcond, conds, rconds, acond, cinsn = NULL_RTX;
+ rtx cond, rcond = NULL_RTX, conds, rconds, acond, cinsn = NULL_RTX;
int repeat;
edge e;
@@ -331,13 +337,17 @@ unswitch_single_loop (struct loops *loops, struct loop *loop,
return;
}
- rcond = reversed_condition (cond);
- if (rcond)
- rcond = canon_condition (rcond);
+ if (cond != const0_rtx
+ && cond != const_true_rtx)
+ {
+ rcond = reversed_condition (cond);
+ if (rcond)
+ rcond = canon_condition (rcond);
- /* Check whether the result can be predicted. */
- for (acond = cond_checked; acond; acond = XEXP (acond, 1))
- simplify_using_condition (XEXP (acond, 0), &cond, NULL);
+ /* Check whether the result can be predicted. */
+ for (acond = cond_checked; acond; acond = XEXP (acond, 1))
+ simplify_using_condition (XEXP (acond, 0), &cond, NULL);
+ }
if (cond == const_true_rtx)
{
OpenPOWER on IntegriCloud