1 2009-07-17 Richard Guenther <rguenther@suse.de>
3 Merge from trunk r149721.
5 2009-06-03 Richard Guenther <rguenther@suse.de>
7 Merge from trunk r148125.
9 2009-04-11 Richard Guenther <rguenther@suse.de>
11 * c-common.c (c_fully_fold_internal): Handle *NV_EXPR.
13 2009-04-11 Richard Guenther <rguenther@suse.de>
15 Merge from trunk r145957.
17 2009-04-03 Richard Guenther <rguenther@suse.de>
19 Merge from trunk r145507.
21 2009-03-18 Richard Guenther <rguenther@suse.de>
23 * fold-const.c (extract_muldiv_1): Retain NV arithmetic
24 variants in some cases.
25 * c-common.c (pointer_int_sum): Remove re-association
26 optimization. Do the multiplication with the element sign
27 with the same sign as the offset expression.
29 (forward_propagate_addr_into_variable_array_index): Look
30 through widening conversions.
33 * gcc.dg/fold-extendmult-1.c: New testcase.
35 2009-03-18 Richard Guenther <rguenther@suse.de>
37 * fold-const.c (extract_muldiv_1): Handle *NV_EXPR where
38 appropriate. Remove TYPE_OVERFLOW_* checks.
40 2009-03-16 Richard Guenther <rguenther@suse.de>
42 * fold-const.c (fold_binary): Fold (T1)X +- (T1)Y to (T1)(X +- Y)
43 if the cast is only a sign change.
45 2009-03-12 Richard Guenther <rguenther@suse.de>
47 * fold-const.c (split_tree): Handle *NV_EXPR.
48 (associate_trees): Likewise.
49 (fold_binary): Re-enable reassociation. Remove restriction
50 for reassociating signed integers or pointers.
52 2009-03-12 Richard Guenther <rguenther@suse.de>
54 * fold-const.c (fold_plusminus_mult_expr): Handle *NV_EXPR.
55 (fold_binary): Complete PLUS_EXPR, MINUS_EXPR and MULT_EXPR
58 2009-03-12 Richard Guenther <rguenther@suse.de>
60 * fold-const.c (may_negate_without_overflow_p): Unsigned zero
61 can be negated without overflow.
62 (negate_expr_p): Handle *NV_EXPR.
63 (fold_negate_expr): Likewise.
64 (fold_binary): Avoid loosing non-overflow flag during
65 A - B -> A + (-B) folding with constant B.
67 2009-03-10 Richard Guenther <rguenther@suse.de>
69 * fold-const.c (fold_comparison): Adjust address comparison
71 * tree.h (strip_nv): Also strip POINTER_PLUSNV_EXPR.
72 * tree-ssa-dom.c (initialize_hash_element): Treat *NV_EXPR the
73 same as non-NV_EXPR variants for value-numbering.
74 (simple_iv_increment_p): Handle *NV_EXPR.
76 2009-03-10 Richard Guenther <rguenther@suse.de>
78 * builtins.c (get_pointer_alignment): Handle POINTER_PLUSNV_EXPR.
79 (get_memory_rtx): Likewise.
80 * expr.c (string_constant): Likewise.
81 * tree-object-size.c (plus_stmt_object_size): Likewise.
82 (collect_object_sizes_for): Likewise.
83 (check_for_plus_in_loops_1): Likewise.
85 2009-03-09 Richard Guenther <rguenther@suse.de>
87 * fold-const.c (try_move_mult_to_index): Only move idx * size
88 in &x[i] + idx * size into the index if the multiplication
90 (fold_unary): Always fold (T1)(X p+ Y) to ((T1)X p+ Y).
91 Simplify that folding.
92 Fold abs(NEGATENV_EXPR) the same as abs(NEGATE_EXPR).
93 (fold_binary): Audit all pointer-plus folding. Preserve
94 non-wrapping variants where that is easily correct.
95 (tree_unary_nonnegative_warnv_p): Remove dead TYPE_OVERFLOW_UNDEFINED
96 case. Handle CONVERT_EXPR the same as NOP_EXPR.
97 (tree_binary_nonnegative_warnv_p): POINTER_PLUS*_EXPR are not
98 handled at all. Handle PLUSNV_EXPR and MULTNV_EXPR specially.
99 * tree-ssa-ccp.c (likely_value): Handle *NV_EXPR.
100 (ccp_fold): Also fold POINTER_PLUSNV_EXPR.
101 (maybe_fold_stmt_indirect): Also fold POINTER_PLUSNV_EXPR.
102 (fold_stmt_r): Likewise.
103 * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_arr):
104 Only fold non-overflowed multiplications.
105 (forward_propagate_addr_expr_1): Handle POINTER_PLUSNV_EXPR.
106 * tree-vrp.c (supports_overflow_infinity): The assert that the
107 type needs overflow infinity is bogus now.
109 2009-03-09 Richard Guenther <rguenther@suse.de>
111 * tree-ssa-loop-niter.c (split_to_var_and_offset): Handle *NV_EXPR.
112 (expand_simple_operations): Likewise.
113 (derive_constant_upper_bound_ops): Likewise.
114 * tree-scalar-evolution.c (add_to_evolution): Handle MINUSNV_EXPR.
115 (follow_ssa_edge_binary): Handle *NV_EXPR.
116 (follow_ssa_edge_expr): Likewise.
117 (interpret_rhs_expr): Likewise.
118 (instantiate_scev_1): Likewise.
119 * tree-chrec.c (chrec_fold_poly_cst): Likewise.
120 (chrec_fold_plus_poly_poly): Likewise.
121 (chrec_fold_plus_1): Likewise.
122 (operator_is_linear): Likewise.
123 * tree-vectorizer.c (reduction_code_for_scalar_code):
125 * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Handle
127 (vect_recog_widen_mult_pattern): Handle MULTNV_EXPR.
128 (vect_recog_widen_sum_pattern): Handle PLUSNV_EXPR.
129 * tree-vect-transform.c (get_initial_def_for_reduction): Handle
131 (vect_min_worthwhile_factor): Handle *NV_EXPR.
132 (vectorizable_operation): Treat POINTER_PLUSNV_EXPR as PLUS_EXPR.
134 2009-03-09 Richard Guenther <rguenther@suse.de>
136 * tree.h (int_const_binop_1): Declare.
137 * fold-const.c (add_double_with_sign): Fix unsigned overflow
139 (int_const_binop_1): Export. Fix unsigned overflow detection.
140 * stor-layout.c (layout_type): Drop TREE_OVERFLOW on TYPE_SIZE
142 * tree-vrp.c (integral_range_p): New helper.
143 (simplify_unary_for_nonwrapping): Likewise.
144 (simplify_binary_for_nonwrapping): Likewise.
145 (simplify_stmt_using_ranges): Call them.
147 2009-03-06 Richard Guenther <rguenther@suse.de>
149 * fold-const.c (maybe_canonicalize_comparison_1): Canonicalize
150 A +- CST code arg1 if A +- CST does not overflow.
151 (fold_comparison): Transform X +- C1 CMP Y +- C2 to
152 X CMP Y +- C2 +- C1 if X +- C1 does not overflow and C2 +- C1
153 is less in magnitude than C2.
155 2009-03-06 Richard Guenther <rguenther@suse.de>
157 * fold-const.c (int_const_binop_1): New worker function split
159 (int_const_binop): ... here.
160 (fold_comparison): Adjust X +- C1 CMP C2 to X CMP C2 +- C1 folding
161 to always apply if X +- C1 does not overflow.
163 2009-03-06 Richard Guenther <rguenther@suse.de>
165 * tree.def (PLUSNV_EXPR, MINUSNV_EXPR, MULTNV_EXPR,
166 POINTER_PLUSNV_EXPR, NEGATENV_EXPR): Fix tree code name.
168 2009-03-06 Richard Guenther <rguenther@suse.de>
170 * c-typeck.c (build_unary_op): Treat flag_strict_overflow the
172 (build_binary_op): Likewise.
175 * typeck.c (cp_build_binary_op): Deal with *NV_EXPR. Build
176 *NV_EXPR variants for signed arithmetic with undefined overflow.
177 (cp_build_unary_op): Likewise.
178 * semantics.c (handle_omp_for_class_iterator): Deal with *NV_EXPR.
180 2009-03-06 Richard Guenther <rguenther@suse.de>
182 * fold-const.c (negate_expr_p): Only do not negate integer
183 constants if overflows on the type trap and the negation
184 might overflow. Remove superfluous TYPE_OVERFLOW_WRAPS checks.
185 Do not negate divisions on integral types.
186 (fold_negate_expr): Do not negate divisions on integral types.
187 (build_range_check): Remove superfluous TYPE_OVERFLOW_WRAPS checks.
188 (extract_muldiv_1): Likewise.
189 (fold_unary): Likewise for (T1)(X * Y) to (T1)X * (T1)Y folding.
190 Adjust folding to also apply to MULTNV_EXPR if NV is dropped
193 2009-03-06 Richard Guenther <rguenther@suse.de>
195 * fold-const.c (fold_binary): Enable pointer re-association
196 for POINTER_PLUSNV_EXPR.
197 * gimplify.c (gimplify_expr): Handle POINTER_PLUSNV_EXPR.
198 (gimplify_omp_for): Handle *NV_EXPR.
199 * convert.c (convert_to_integer): Handle PLUSNV_EXPR and
200 MINUSNV_EXPR in narrowing properly. Remove use of
202 * omp-low.c (extract_omp_for_data): Handle *NV_EXPR.
204 2009-03-05 Richard Guenther <rguenther@suse.de>
206 * c-common.c (pointer_int_sum): Use *NV_EXPR codes for
208 * c-typeck.c (build_unary_op): Use NEGATENV_EXPR if
209 signed arithmetic has undefined overflow.
210 (build_binary_op): Handle *NV_EXPR for recursive invocations.
211 If signed arithmetic has undefined overflow use
212 PLUSNV_EXPR, MINUSNV_EXPR and MULTNV_EXPR.
213 * c-omp.c (c_finish_omp_for): Deal with *NV_EXPR for increments.
215 2009-03-05 Richard Guenther <rguenther@suse.de>
217 * expr.c (expand_expr_real_1): Handle POINTER_PLUSNV_EXPR,
218 PLUSNV_EXPR, MINUSNV_EXPR, MULTNV_EXPR and NEGATENV_EXPR.
219 * flags.h (TYPE_OVERFLOW_WRAPS): Define to always true.
220 (TYPE_OVERFLOW_UNDEFINED): Define to always false.
221 (POINTER_TYPE_OVERFLOW_UNDEFINED): Define to always false.
222 * optabs.c (optab_for_tree_code): Handle *NV_EXPR.
223 * tree-cfg.c (verify_gimple_assign_unary): Likewise.
224 (verify_gimple_assign_binary): Likewise.
225 * tree-inline.c (estimate_operator_cost): Likewise.
226 * tree-pretty-print.c (dump_generic_node): Likewise.
227 (op_code_prio): Likewise.
228 (op_symbol_code): Likewise.
229 * tree-ssa-structalias.c (find_func_aliases): Handle
231 * tree.c (build2_stat): Adjust checks.
232 (associative_tree_code): Add PLUSNV_EXPR and MULTNV_EXPR.
233 (commutative_tree_code): Add PLUSNV_EXPR and MULTNV_EXPR.
234 (undefined_overflow_used_p_1): New function.
235 * tree.def (PLUSNV_EXPR, MINUSNV_EXPR, MULTNV_EXPR,
236 POINTER_PLUSNV_EXPR, NEGATENV_EXPR): New tree codes for
237 operations that are known to not overflow.
238 * tree.h (NEGATE_EXPR_CODE_P, PLUS_EXPR_CODE_P,
239 POINTER_PLUS_EXPR_CODE_P, MINUS_EXPR_CODE_P, MULT_EXPR_CODE_P): New.
240 (NEGATE_EXPR_P, PLUS_EXPR_P, POINTER_PLUS_EXPR_P, MINUS_EXPR_P,
241 MULT_EXPR_P): Likewise.
242 (strip_nv): New inline function.
243 (undefined_overflow_used_p_1): Declare.
244 (undefined_overflow_used_p): New inline function.
245 * varasm.c (narrowing_initializer_constant_valid_p): Handle
247 (initializer_constant_valid_p): Handle *NV_EXPR.
248 * omp-low.c (omp_reduction_init): Likewise.
249 * gimple-pretty-print.c (dump_unary_rhs): Handle NEGATENV_EXPR.
250 * fold-const.c (fold_negate_expr): Likewise.
251 (int_const_binop): Handle *NV_EXPR.
252 (fold_unary): Handle NEGATENV_EXPR.
253 (tree_binary_nonzero_warnv_p): The type argument is unused.
254 (fold_binary): Handle simple cases for POINTER_PLUSNV_EXPR,
255 PLUSNV_EXPR, MINUSNV_EXPR and MULTNV_EXPR.