[Bug tree-optimization/14341] Missed comparison optimization (VRP)

2005-05-07 Thread pinskia at gcc dot gnu dot org

--- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-07 
19:30 ---
Huh, I don't understand why VRP does not take care of this:
i_13: [-2147483648, ]
  D.1236_4 = i_13 <= ;


  i_13 = ASSERT_EXPR ;
  D.1236_4 = i_13 <= ;


The following is the testcase which I used with -O2 -fno-tree-dominator-opts, 
otherwise VRP is not 
run:
void f(int);
int h(int, int);
void t(int *ttt)
{
  int i;
  int x;
  *ttt  = 1;
if (ttt== 0)
  f(0);
for( i = 0; i < 1; i++ ){
f(i < 1);
}

}

-- 
   What|Removed |Added

 CC||dnovillo at gcc dot gnu dot
   ||org
Summary|Missed comparison   |Missed comparison
   |optimization (jump threading|optimization (VRP)
   |related)|


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14341


[Bug tree-optimization/14341] Missed comparison optimization (VRP)

2005-06-01 Thread cvs-commit at gcc dot gnu dot org

--- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-02 
02:57 ---
Subject: Bug 14341

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]   2005-06-02 02:57:15

Modified files:
gcc: ChangeLog fold-const.c tree-flow.h 
 tree-ssa-ccp.c tree-ssa-copy.c 
 tree-ssa-propagate.c tree-ssa-propagate.h 
 tree-vrp.c tree.h 
gcc/testsuite  : ChangeLog 
gcc/testsuite/gcc.dg/tree-ssa: pr14841.c pr21658.c 
Added files:
gcc/testsuite/gcc.dg/tree-ssa: pr14341.c pr20701.c pr21029.c 
   pr21086.c pr21090.c pr21332.c 
   pr21458.c vrp01.c vrp02.c vrp03.c 
   vrp04.c vrp05.c vrp06.c vrp07.c 
   vrp08.c vrp09.c vrp10.c vrp11.c 
   vrp12.c vrp13.c 

Log message:
2005-06-01  Diego Novillo  <[EMAIL PROTECTED]>

PR 14341, PR 21332, PR 20701, PR 21029, PR 21086, PR 21090
PR 21289, PR 21348, PR 21367, PR 21368, PR 21458.
* fold-const.c (invert_tree_comparison): Make extern.
* tree-flow.h (enum value_range_type): Move to tree-ssa-propagate.
(struct value_range_def): Limewise.
(get_value_range): Remove.
(dump_value_range): Remove.
(dump_all_value_ranges): Remove.
(debug_all_value_ranges): Remove.
(vrp_evaluate_conditional): Declare.
* tree-ssa-propagate.c (struct prop_stats_d): Add field
num_pred_folded.
(substitute_and_fold): Add argument use_ranges_p.
Update all callers.
If use_ranges_p is true, call fold_predicate_in to fold
predicates using range information.
Ignore ASSERT_EXPRs.
Change debugging output to only show statements that have been
folded.
(replace_phi_args_in): Move debugging output code from
substitute and fold.
(fold_predicate_in): New local function.
* tree-ssa-propagate.h (enum value_range_type): Move from
tree-flow.h.
(struct value_range_d): Likewise.
Add field 'equiv'.
(value_range_t): Rename from value_range.
* tree-vrp.c (found_in_subgraph): Rename from found.
(get_opposite_operand): Remove.
(struct assert_locus_d): Declare.
(assert_locus_t): Declare.
(need_assert_for): Declare.
(asserts_for): Declare.
(blocks_visited): Declare.
(vr_value): Declare.
(set_value_range): Add argument 'equiv'.
Don't drop to VARYING ranges that cover all values in the
type.
Make deep copy of equivalence set 'equiv'.
(copy_value_range): New local function.
(set_value_range_to_undefined): New local function.
(compare_values): Return -2 if either value has overflowed.
(range_includes_zero_p): New local function.
(extract_range_from_assert): Flip the predicate code if the
name being asserted is on the RHS of the predicate.
Avoid creating unnecessary symbolic ranges if the comparison
includes another name with a known numeric range.
Update the equivalnce set of the new range when asserting
EQ_EXPR predicates.
(extract_range_from_ssa_name): Update the equivalence set of
the new range with VAR.
(extract_range_from_binary_expr): Also handle TRUTH_*_EXPR.
If -fwrapv is used, set the resulting range to VARYING if the
operation overflows.  Otherwise, use TYPE_MIN_VALUE and
TYPE_MAX_VALUE to represent -INF and +INF.
Fix handling of *_DIV_EXPR.
(extract_range_from_unary_expr): Handle MINUS_EXPR and
ABS_EXPR properly by switching the range around if necessary.
(extract_range_from_comparison): New local function.
(extract_range_from_expr): Call it.
(adjust_range_with_scev): Do not adjust the range if using
wrapping arithmetic (-fwrapv).
(dump_value_range): Also show equivalence set.
Show -INF and +INF for TYPE_MIN_VALUE and TYPE_MAX_VALUE.
(build_assert_expr_for): Also build ASSERT_EXPR for EQ_EXPR.
(infer_value_range): Change return value to bool.
Add arguments 'comp_code_p' and 'val_p'.
Do not attempt to infer ranges from statements that may throw.
Store the comparison code in comp_code_p.
Store the other operand to be used in the predicate in val_p.
(dump_asserts_for): New.
(debug_asserts_for): New.
(dump_all_asserts): New.
(debug_all_asserts): New.
(register_new_assert_for): New.
(register_edge_assert_for): New.
(find_conditional_asserts): New.
(find_assert_locations): New.
(process_assert_insertions_for): New.
(process_assert_insertions): New.

[Bug tree-optimization/14341] Missed comparison optimization (VRP)

2005-06-01 Thread dnovillo at gcc dot gnu dot org

--- Additional Comments From dnovillo at gcc dot gnu dot org  2005-06-02 
03:03 ---

Fixed.  http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00127.html

-- 
   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14341


[Bug tree-optimization/14341] Missed comparison optimization (VRP)

2005-06-02 Thread pinskia at gcc dot gnu dot org


-- 
   What|Removed |Added

   Target Milestone|--- |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14341


[Bug tree-optimization/14341] Missed comparison optimization (VRP)

2005-09-10 Thread pinskia at gcc dot gnu dot org


-- 
Bug 14341 depends on bug 18373, which changed state.

Bug 18373 Summary: [meta-bug] VRP Value Range Propagation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18373

   What|Old Value   |New Value

 Status|NEW |RESOLVED
 Resolution||FIXED

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14341