1 2015-04-07 Richard Biener <rguenther@suse.de>
3 Merge from trunk r219384 through r221893.
5 2015-01-16 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
7 * genmatch.c (print_matches): Remove.
8 (main): Inline calls to print_matches.
10 2015-01-12 Richard Biener <rguenther@suse.de>
12 Merge from trunk r218478 through r219383.
14 2014-12-21 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
16 * genmatch.c (parser::parse_simplify): Make last two parametes have
18 (parser::parse_pattern): Adjust call to parser::parse_simplify to
19 avoid passing default arguments.
21 2014-12-15 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
23 * genmatch.c (capture::name): New.
24 (capture::capture): New default argument.
25 (parse_capture): Pass id to capture::capture.
26 (print_operand): Print name of capture if available.
28 2014-12-08 Richard Biener <rguenther@suse.de>
30 Merge from trunk r218262 through r218477.
32 2014-12-02 Richard Biener <rguenther@suse.de>
34 * match-builtin.pd: Use operator lists directly where
37 2014-12-02 Richard Biener <rguenther@suse.de>
39 Merge from trunk r217561 through r218261.
41 2014-11-14 Richard Biener <rguenther@suse.de>
43 Merge from trunk r217546 through r217560.
45 Brings back next merge piece.
47 2014-11-14 Richard Biener <rguenther@suse.de>
49 Merge from trunk r217497 through r217545.
51 Brings back next merge piece.
53 2014-11-13 Richard Biener <rguenther@suse.de>
55 * match.pd: Implement more binary patterns exercised by
57 * fold-const.c (sing_bit_p): Export.
58 (exact_inverse): Likewise.
59 (fold_binary_loc): Remove patterns here.
60 (tree_unary_nonnegative_warnv_p): Use CASE_CONVERT.
61 * fold-const.h (sing_bit_p): Declare.
62 (exact_inverse): Likewise.
63 * genmatch.c (add_operator): Allow CONSTRUCTOR.
64 (dt_node::gen_kids): Handle CONSTRUCTOR not as GENERIC.
65 (parser::parse_op): Allow to iterate over predicates.
67 2014-11-13 Richard Biener <rguenther@suse.de>
69 * match.pd: Remove redundant pattern. Inline remaining
70 stuff from match-rotate.pd and match-conversions.pd.
71 * match-rotate.pd: Remove.
72 * match-conversions.pd: Likewise.
74 2014-11-13 Richard Biener <rguenther@suse.de>
76 Merge from trunk r217417 through r217496.
78 Brings back next merge piece.
80 2014-11-12 Richard Biener <rguenther@suse.de>
82 Merge from trunk r217261 through r217416.
84 Brings back next merge piece.
86 * match-plusminus.pd: Remove.
88 2014-11-10 Richard Biener <rguenther@suse.de>
90 * tree-ssa-forwprop.c (simplify_conversion_from_bitmask): Remove.
91 (associate_plusminus): Likewise.
92 (combine_conversions): Likewise.
93 (simplify_mult): Likewise.
94 (pass_forwprop::execute): Adjust.
95 * gimple-fold.c (fold_gimple_assign): Remove dispatches to
96 fold_binary_loc and fold_ternary_loc.
97 (gimple_fold_stmt_to_constant_1): Likewise.
99 2014-11-09 Richard Biener <rguenther@suse.de>
101 Merge from trunk r217075 through r217260.
103 Brings back next merge piece.
105 2014-11-04 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
107 * genmatch.c (user_id): Add new member is_oper_list.
108 (user_id::user_id): Add new default argument.
109 (parser::parse_operator_list): New function.
110 (parser::parse_for): Allow operator-list.
111 (parser::parse_pattern): Call parser::parse_operator_list.
112 (parser::parse_operation): Reject operator-list.
113 * match-builtin.pd: Define operator lists POWs, CBRTs and SQRTs.
115 2014-11-04 Richard Biener <rguenther@suse.de>
117 Merge from trunk r216941 through r217074.
119 Brings back next merge piece.
121 2014-10-31 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
123 * genmatch.c (parser::parse_c_expr): Mark user-defined ops as used.
125 2014-10-31 Richard Biener <rguenther@suse.de>
127 Merge from trunk r216800 through r215940.
129 Brings back next merge piece.
131 2014-10-30 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
133 * genmatch.c (parser::parse_op): Check if predicate is used in
136 2014-10-29 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
138 * genmatch.c (parser::parse_for): Make sure to have a valid
139 token to report errors at.
141 2014-10-29 Richard Biener <rguenther@suse.de>
143 * tree-ssa-sccvn.c (try_to_simplify): Allow
144 gimple_fold_stmt_to_constant_1 to follow SSA use-def chains.
145 (visit_use): Likewise.
147 2014-10-28 Richard Biener <rguenther@suse.de>
149 Merge from trunk r216772 through r216799.
151 Brings back next merge piece.
153 2014-10-28 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
155 * genmatch.c (parser): Add new member parsing_match_operand.
156 (parser::parse_operation): Check for conditional convert in result
158 (parser::parse_expr): Check for commutative operator in result operand.
159 Check for :type in match operand.
160 (parser::parse_simplify): Set/unset parsing_match_operand.
161 (parser::parser): Initialize parsing_match_operand.
163 2014-10-28 Richard Biener <rguenther@suse.de>
165 * genmatch.c (parser::parse_for): Properly check for already
168 2014-10-28 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
170 * genmatch.c (error_cb): Adjust for printing warnings.
171 (warning_at): New function.
172 (user_id): Add new member used.
173 (get_operator): Mark user_id as used.
174 (parse_for): Warn for unused operators.
176 2014-10-28 Richard Biener <rguenther@suse.de>
178 Merge from trunk r216632 through r216771.
180 Brings back third merge piece.
182 2014-10-24 Richard Biener <rguenther@suse.de>
184 Merge from trunk r216543 through r216631.
186 Brings back second merge piece.
188 2014-10-24 Richard Biener <rguenther@suse.de>
190 * genmatch.c (capture_info::capture_info): Initialize
191 force_no_side_effects.
193 2014-10-23 Richard Biener <rguenther@suse.de>
195 * genmatch.c (capture_info): New class.
196 (capture_info::capture_info): New constructor.
197 (capture_info::walk_match): New method.
198 (capture_info::walk_result): New method.
199 (capture_info::walk_c_expr): New method.
200 (dt_simplify::gen): Handle preserving side-effects for
201 GENERIC code generation.
202 (decision_tree::gen_generic): Do not reject operands
203 with TREE_SIDE_EFFECTS.
205 2014-10-22 Richard Biener <rguenther@suse.de>
207 * generic-match.h: New file.
208 * generic-match-head.c: Include generic-match.h, not gimple-match.h.
209 * fold-const.c: Include generic-match.h.
210 (fold_unary_loc): Remove local prototype of generic_simplify.
211 (fold_binary_loc): Likewise.
212 (fold_ternary_loc): Likewise.
214 2014-10-22 Richard Biener <rguenther@suse.de>
216 * fold-const.c (fold_unary_loc): Adjust for generic_simplify
218 (fold_binary_loc): Likewise.
219 (fold_ternary_loc): Likewise.
220 (fold_binary_loc): Remove patterns implemented by
221 match-constant-folding.pd.
222 * match.pd: Fold in match-constant-folding.pd and adjust
223 it for the non_lvalue changes and make it match fold-const.c
224 * match-constant-folding.pd: Remove.
226 * genmatch.c (expr::gen_transform): Use fold_buildN_loc
227 and build_call_expr_loc.
228 (dt_simplify::gen): Drop non_lvalue for GIMPLE, use
229 non_lvalue_loc to build it for GENERIC.
230 (decision_tree::gen_generic): Add location argument to
231 generic_simplify prototype.
233 2014-10-22 Richard Biener <rguenther@suse.de>
235 Merge from trunk r216394 through r216542.
237 Brings back infrastructure merge.
239 2014-10-21 Richard Biener <rguenther@suse.de>
241 * gimple-fold.c (replace_stmt_with_simplification): New helper
243 (fold_stmt_1): ... here. Discard the simplified sequence if
246 2014-10-20 Richard Biener <rguenther@suse.de>
248 * genmatch.c (main): Change -gimple and -generic to
249 --gimple and --generic.
250 * Makefile.in (s-match): Adjust.
252 2014-10-20 Richard Biener <rguenther@suse.de>
254 * gimple-fold.c (gimple_convert): Move out-of-line from ...
255 * gimple-fold.h (gimple_convert): ... here.
257 2014-10-17 Richard Biener <rguenther@suse.de>
259 Merge from trunk r216316 through r216394.
261 2014-10-17 Richard Biener <rguenther@suse.de>
263 * genmatch.c (simplify::simplify): Fix off-by-one error.
265 2014-10-16 Richard Biener <rguenther@suse.de>
267 * fold-const.c (fold_comparison): Remove redundant constant
268 folding and operand swapping.
269 (fold_binary_loc): Do comparison operand swapping here,
270 dispatch to generic_simplify after operand canonicalization.
271 (fold_ternary_loc): Canonicalize operand order for
272 commutative ternary operations.
273 * tree.c (commutative_ternary_tree_code): Add DOT_PROD_EXPR
276 2014-10-16 Richard Biener <rguenther@suse.de>
278 Merge from trunk r216235 through r216315.
280 2014-10-16 Richard Biener <rguenther@suse.de>
282 * tree-ssa-forwprop.c (fwprop_ssa_val): Adjust comment.
284 2014-10-15 Richard Biener <rguenther@suse.de>
286 * fold-const.h (negate_expr_p): Revert exporting this.
287 * fold-const.c (negate_expr_p): Likewise.
289 2014-10-15 Richard Biener <rguenther@suse.de>
291 * gimple-match-head.c: Remove trailing whitespace.
292 * genmatch.c: Likewise.
294 2014-10-15 Richard Biener <rguenther@suse.de>
296 Merge from trunk r214675 through r216234.
298 * hash-table.h: Do not include ggc.h on the host but just declare
299 a few ggc allocation templates.
300 * tree-ssa-pre.c (create_component_ref_by_pieces_1): Set
301 VUSE on built call stmts.
303 2014-10-14 Richard Biener <rguenther@suse.de>
305 * gimple-fold.h (no_follow_ssa_edges): Declare.
306 (gimple_fold_stmt_to_constant_1): Add separate valueize hook for
307 gimple_simplify, defaulted to no_follow_ssa_edges.
308 * gimple-fold.c (fold_stmt): Make old API never follow SSA edges
310 (no_follow_ssa_edges): New function.
311 (gimple_fold_stmt_to_constant_1): Adjust.
312 * tree-cfg.c (no_follow_ssa_edges): Remove.
313 (replace_uses_by): Use plain fold_stmt again.
314 * gimple-match-head.c (gimple_simplify): When simplifying
315 a statement do not stop when valueizing its operands yields NULL.
317 2014-10-14 Richard Biener <rguenther@suse.de>
319 * Makefile.in (BUILD_RTL): Revert not needed change.
320 * match.pd (integral_op_p): Remove predicate and use.
321 * generic-match-head.c: Include gimple-match.h and remove
323 * gimple-match-head.c (integral_op_p): Remove.
325 2014-10-14 Richard Biener <rguenther@suse.de>
327 * genmatch.c (dt_operand::gen_gimple_expr): Check for an
328 invariant operand before valueizing it.
330 2014-10-14 Richard Biener <rguenther@suse.de>
332 * genmatch.c: Whitespace and comment fixes, some minor
335 2014-10-14 Richard Biener <rguenther@suse.de>
337 * doc/match-and-simplify.texi: Update.
339 2014-10-07 Richard Biener <rguenther@suse.de>
341 * genmatch.c (parser::parse_pattern): Change match parsing
342 to expect the matching template first, not as result.
343 (parser::parse_simplify): Likewise.
344 * match-bitwise.pd: Adjust.
346 2014-09-26 Richard Biener <rguenther@suse.de>
348 * genmatch.c (dt_node::gen_kids): Handle conversions in
349 generic expressions properly.
350 * match-bitwise.pd ((type) X & CST -> (type) (X & ((type-x) CST))):
351 Disable on GENERIC as it conflicts with a transform in fold-const.c.
354 * typeck.c (enum_cast_to_int): Use CONVERT_EXPR_P to check
357 2014-09-26 Richard Biener <rguenther@suse.de>
359 * genmatch.c (struct dt_node): Merge gen_gimple and gen_generic
360 into gen, merge gen_gimple_kids and gen_generic_kids into
362 (struct dt_operand): Likewise.
364 2014-09-25 Richard Biener <rguenther@suse.de>
366 * genmatch.c (struct c_expr): Also record capture identifier
368 (c_expr::gen_transform): Use it.
370 2014-09-25 Richard Biener <rguenther@suse.de>
372 * genmatch.c: Include <map>, <utility> and <string>.
373 Allow identifiers for captures, assign capture indexes
376 2014-09-25 Richard Biener <rguenther@suse.de>
378 * genmatch.c: Keep track of the maximum capture index used
379 and get rid of the static constant dt_simplify::capture_max.
381 2014-09-25 Richard Biener <rguenther@suse.de>
383 * genmatch.c: Put all AST parsing into a class parser
384 simplifying state management. Keep a vector of user
385 predicates in order of definition.
387 2014-09-25 Richard Biener <rguenther@suse.de>
391 2014-09-24 Richard Biener <rguenther@suse.de>
393 * genmatch.c (c_expr::output_code): Remove and inline into ...
394 (c_expr::gen_transform): ... here.
395 (outline_c_exprs): Remove.
396 (main): Do not call outline_c_exprs.
398 2014-09-24 Richard Biener <rguenther@suse.de>
400 * genmatch.c (struct id_base): Move nargs member here.
401 (check_operator): Remove.
402 (check_no_user_id): Likewise.
403 (parse_operation): Fix error locations, handle convert0/2
405 (parse_expr): Error on non-matching arity.
406 (parse_for): Compute arity of user-ids and complain for
407 inconsistent substitutions.
409 2014-09-24 Richard Biener <rguenther@suse.de>
411 * genmatch.c (id_base): Derive from typed_noop_remove.
412 (struct user_id): New id_base derivative.
413 (struct simplify): Add vector of fors.
414 (lower_commutative): Adjust.
415 (lower_opt_convert): Likewise.
416 (replace_id): Work with user_id / id_base pairs.
417 (lower_for): New function, split out from ...
418 (parse_for): ... here. Maintain a stack of active fors,
419 record substitutes in user_id.
420 (<everywhere>): Adjust for simplify constructor change and
421 maintaining of the stack of active fors.
422 * match-bitwise.pd: Enable truth_valued_p for comparison
425 2014-09-23 Richard Biener <rguenther@suse.de>
427 * genmatch.c (struct e_operation): Remove.
428 (struct expr): Replace e_operation operation with id_base. Add
429 is_commutative member.
430 (<everywhere>): Remove indirections through e_operation, move
431 is_commutative handling to expr objects.
432 (parse_for): Temporarily insert user-defined operators into the
433 operator identifier hash.
435 2014-09-23 Richard Biener <rguenther@suse.de>
437 * genmatch.c (error_cb): Implement simple caret diagnostics.
439 2014-09-23 Richard Biener <rguenther@suse.de>
441 * genmatch.c (parse_if): Maintain a vector of active ifs and
443 (dt_simplify::gen): Adjust.
444 (copy_reverse): Remove.
445 (parse_simplify): Adjust.
446 (parse_for): Likewise.
447 (parse_pattern): Likewise.
450 2014-09-23 Richard Biener <rguenther@suse.de>
452 * genmatch.c (struct predicate_id): Add nargs member.
453 (struct simplify): Remove name member.
454 (lower_commutative): Adjust.
455 (lower_opt_convert): Likewise.
456 (dt_node::gen_gimple_kids): Generate code for predicate
458 (dt_node::gen_generic_kids): Likewise.
459 (dt_simplify::gen): Likewise.
460 (write_predicate_prototype): New function.
461 (write_predicate): Adjust.
462 (parse_simplify): Be less forgiving about errors, handle
463 predicate expression definitions.
464 (parse_pattern): Adjust.
465 (main): Output prototypes for all predicates first.
466 * match-bitwise.pd (X & !X -> 0, X | !X and X ^ !X -> 1):
467 Implement using predicate expressions, more closely matching
468 code in tree-ssa-forwprop.c.
470 2014-09-23 Richard Biener <rguenther@suse.de>
472 * gimple-match-head.c (gimple_resimplify2): Also swap
474 (gimple_simplify): Likewise.
476 2014-09-16 Richard Biener <rguenther@suse.de>
478 * genmatch.c (struct predicate_id): Add matchers member.
479 (add_predicate): Return added predicate.
480 (dt_node::gen_gimple_kids, dt_node::gen_generic_kids): Relocate
482 (dt_operand::gen_gimple_kids, dt_node::gen_generic_kids): ... here.
483 (check_no_user_id): Guard against NULL result.
484 (dt_operand::get_name): Handle NULL parent.
485 (dt_operand::gen_opname): Likewise.
486 (dt_operand::gen_predicate): Mangle user-defined predicates.
487 (dt_operand::gen_generic): Adjust.
488 (dt_operand::gen_gimple): Likewise.
489 (dt_simplify::gen): Guard against NULL result.
490 (write_predicate): New function.
491 (write_header): Only write header, not split out c-exprs.
492 (parse_simplify): Move identifier handling out, handle
494 (parse_pattern): Parse (match <id> ...). Drop optional
495 identifier from (simplify...).
496 (lower): New function, split out from ...
497 (main): ... here. Generate code for all user-defined
499 * match.pd (negate_expr_p): Implement as predicate.
500 * match-comparison.pd: Use negate_expr_p predicate.
502 2014-09-16 Richard Biener <rguenther@suse.de>
504 * genmatch.c (id_base::id_kind): Add PREDICATE.
505 (struct predicate_id): New id_base variant.
506 (is_a_helper): Add predicate_id support.
507 (add_predicate): New function.
508 (struct predicate): Adjust.
509 (print_operand): Likewise.
510 (cmp_operand): Likewise.
511 (dt_operand::gen_predicate): Likewise.
512 (parse_op): Likewise. Error out on unknown predicates.
513 (parse_predicates): New function.
514 (parse_pattern): Call it.
515 * match.pd: Define used predicates.
517 2014-09-16 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
519 * genmatch.c (operand::gen_transform): Add dt_operand ** default
520 argument to operand heirarchy.
521 (expr::gen_transform): Adjust.
522 (capture::gen_transform): Likewise.
523 (dt_simplify::gen): Likewise.
524 * match-builtins.pd: Adjust pattern to use expression captures in
527 2014-09-16 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
529 * genmatch.c (dt_node::level_max): Remove.
531 2014-09-16 Richard Biener <rguenther@suse.de>
533 * genmatch.c (operator_id): Add tcc member.
534 (get_operand_type): New function, split out from ...
535 (expr::gen_transform): ... here. Treat comparisons
537 (dt_simplify::gen): Use get_operand_type.
539 2014-09-15 Richard Biener <rguenther@suse.de>
541 * gimple-fold.c: Include tree-eh.c.
542 (fold_stmt_1): Handle GIMPLE_CONDs for gimple_simplify.
543 * gimple-match-head.c (gimple_simplify): Likewise.
544 * match-comparison.pd (bool != 0): Avoid some churn on
545 GIMPLE and amend comment.
547 2014-09-12 Richard Biener <rguenther@suse.de>
549 * match-constant-folding.pd (x & ~0 -> x): Move ...
550 * match-bitwise.pd: ... here. Implement simplify_not_neg_expr.
551 * match-plusminus.pd: Likewise. Implement simplify_mult.
553 2014-09-12 Richard Biener <rguenther@suse.de>
555 * genmatch.c (expr::gen_transform): Properly autocompute
556 type of REALPART_EXPR and IMAGPART_EXPR.
558 2014-09-12 Richard Biener <rguenther@suse.de>
560 * match-bitwise.pd: Complete tree-ssa-forwprop.c patterns
561 from simplify_bitwise_binary. Implement some from fold_binary.
562 * match-constant-folding.pd: Add some comments.
563 * match-plusminus.pd (~A + 1 -> -A): Fix COMPLEX_TYPE handling.
565 2014-09-11 Richard Biener <rguenther@suse.de>
567 * match-plusminus.pd: Fix typo.
568 * match-conversions.pd: Add pattern for
569 simplify_conversion_from_bitmask.
571 2014-09-11 Richard Biener <rguenther@suse.de>
573 * match-plusminus.pd: More closely match tree-ssa-forwprop.c code.
575 2014-09-11 Richard Biener <rguenther@suse.de>
577 * match-plusminus.pd: Complete associate_plusminus patterns.
578 Properly guard all patterns. Add associate_pointerplus_align
581 2014-09-11 Richard Biener <rguenther@suse.de>
584 * match-conversions.pd ((T1)(X * Y) -> (T1)X * (T1)Y): Restrict
585 to a single or single-use SSA names.
586 * gimple-match-head.c: Include tree-phinodes.h and ssa-iterators.h.
587 * generic-match-head.c: Likewise.
589 2014-09-11 Richard Biener <rguenther@suse.de>
591 * genmatch.c (output_line_directive): Add variant for dump files.
592 (dt_simplify::gen): Write to dump file with TDF_DETAILS what
593 patterns get applied.
594 * gimple-match-head: Include dumpfile.h.
595 * generic-match-head: Likewise.
597 2014-09-10 Richard Biener <rguenther@suse.de>
599 * genmatch.c (parse_for): Allow more flexible replacement counts.
600 * match-builtins.pd: Fix initial patterns and complete them
601 from the source functions. Properly handle all builtin variants.
603 2014-09-10 Richard Biener <rguenther@suse.de>
605 * match-conversions.pd: Fix unsigned type used for
606 shortened multiplication.
608 2014-09-09 Richard Biener <rguenther@suse.de>
610 * genmatch.c (struct expr): Add expr_type member.
611 (expr::gen_transform): Honor explicitely specified type.
612 (parse_expr): Parse ':<ident>' on the operator as identifier
613 specifying the type to use when building the expression.
614 * match-conversions.pd ((T1)(X * Y) -> (T1)X * (T1)Y):
617 2014-09-08 Richard Biener <rguenther@suse.de>
619 * genmatch.c (parse_for): Supply location for errors, remove
621 * match-builtin.pd (pow transforms): Provide an example
624 2014-09-08 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
626 * genmatch.c (peek_ident): Change id to default argument with value 0.
627 (parse_for): Adjust syntax.
628 * match-builtin.pd: Rewrite for-patterns to match new syntax.
629 * match-comparison.pd: Likewise.
630 * match-constant-folding.pd: Likewise.
631 * match-conversions.pd: Likewise.
632 * match-rotate.pd: Likewise.
634 2014-09-03 Richard Biener <rguenther@suse.de>
636 * match-conversions.pd
637 ((view_convert (convert @0)) -> (view_convert @0)): Restrict to
638 conversions that do not change size.
640 2014-09-02 Richard Biener <rguenther@suse.de>
642 * fold-const.h (negate_expr_p): Declare.
643 * fold-const.c (negate_expr_p): Export.
644 * match-comparison.pd: Implement more comparison patterns.
646 2014-09-02 Richard Biener <rguenther@suse.de>
648 * gimple-match-head.c (maybe_build_generic_op): New function.
649 (maybe_push_res_to_seq): Use it.
650 * gimple-match.h (maybe_build_generic_op): Declare.
651 * gimple-fold.c (fold_stmt_1): Use maybe_build_generic_op.
653 2014-09-02 Richard Biener <rguenther@suse.de>
655 * match-conversions.pd: Add more patterns.
657 2014-08-28 Richard Biener <rguenther@suse.de>
659 * gimple-fold.c (fold_stmt_1): Move gimple_simplify dispatch
660 first, add dumping here.
661 * tree-ssa-forwprop.c (pass_forwprop::execute): Remove dumping.
662 * match-builtin.pd: Implement more patterns and fix existing ones.
665 * gcc.dg/tree-ssa/match-1.c: Split into ...
666 * gcc.dg/tree-ssa/match-builtins.c: ... this ...
667 * tree-ssa/match-builtins-fast-math.c: ... and this.
669 2014-08-28 Richard Biener <rguenther@suse.de>
671 * tree-cfg.c (verify_gimple_assign_unary): Do not allow
672 NON_LVALUE_EXPR in gimple.
673 * genmatch.c (main): Always define GENERIC and GIMPLE.
674 * match-constant-folding.pd (x OP 0): Constrain when we
675 generate NON_LVALUE_EXPR further.
677 2014-08-28 Richard Biener <rguenther@suse.de>
679 Merge from trunk r214266 through r214675.
681 2014-08-28 Richard Biener <rguenther@suse.de>
683 * match-constant-folding.pd (x + 0 -> x): Wrap result in
684 a NON_LVALUE_EXPR to account for the C++ frontend folding
685 too early, avoding some spurious testsuite FAILs.
686 * match-conversions.pd: Use convert where that's unconditionally
689 2014-08-27 Richard Biener <rguenther@suse.de>
691 * genmatch.c (is_conversion): New helper, add VIEW_CONVERT_EXPR
692 to the list of conversions.
693 (expr::gen_transform): Use it.
694 (dt_simplify::gen): Properly pass down NULL as the operand
695 type for outermost conversions.
697 2014-08-27 Richard Biener <rguenther@suse.de>
699 * genmatch.c (peek): Fail at unexpected EOF.
700 (main): Do not peek at the next token as we do expect
703 2014-08-27 Richard Biener <rguenther@suse.de>
705 * fold-const.c (fold_binary_loc): Move dispatch to
706 generic_simplfy after folding of operations on two constants.
708 2014-08-26 Richard Biener <rguenther@suse.de>
710 * Makefile.in (gimple-match.o-warn): Add -Wno-unused-variable.
711 (generic-match.o-warn): Likewise.
712 * genmatch.c (struct if_or_with): New.
713 (struct simplify): Change ifexpr vector to a vector of
715 (dt_simplify::gen): Adjust.
716 (parse_simplify): Parse (with {} op).
717 * match.pd ((T1)(~(T2)X) into ~(T1)X): Move to...
718 * match-conversions.pd: ...this new file. Implement basic
719 conversion simplification.
721 2014-08-26 Richard Biener <rguenther@suse.de>
723 * tree-ssa-loop-ivopts.c (ivuse_cmp): New function.
724 (rewrite_uses): Sort the vector of iv_uses after dominator order.
726 2014-08-26 Richard Biener <rguenther@suse.de>
728 * match.pd ((T1)(~(T2) X) -> ~(T1) X): Fix simplification
731 2014-08-21 Richard Biener <rguenther@suse.de>
733 * match.pd ((T1)(~(T2) X) -> ~(T1) X): Paste all comment
734 from fold-const.c, fix simplification result.
736 2014-08-21 Richard Biener <rguenther@suse.de>
738 Merge from trunk r213754 through r214265.
740 2014-08-21 Richard Biener <rguenther@suse.de>
742 * genmatch.c (dt_simplify::gen): New function merged
744 (dt_simplify::gen_gimple, dt_simplify::gen_generic): ... these,
745 made to simple dispatchers.
747 2014-08-21 Richard Biener <rguenther@suse.de>
749 * genmatch.c (*::gen_transform): Add type parameter.
750 (expr::gen_transform): Handle conversion operators by
751 converting to the parent expression type. Properly
752 pass down the expression type to children.
753 (dt_simplify::gen_gimple): Pass down 'type' to gen_transform.
754 (dt_simplify::gen_generic): Likewise.
755 * match.pd ((T1)(~(T2) X) -> ~(T1) X): New pattern.
757 2014-08-21 Richard Biener <rguenther@suse.de>
759 * genmatch.c (dt_operand::gen_gimple_expr): Only match
760 non-reference-like GIMPLE single RHS.
762 2014-08-20 Richard Biener <rguenther@suse.de>
764 * genmatch.c (copy_reverse): New function.
765 (parse_simplify): Support nested inner ifs.
766 * match-comparison.pd: Use nested inner ifs.
768 2014-08-20 Richard Biener <rguenther@suse.de>
770 * match-and-simplify.texi: Fix errors during pdf build.
772 2014-08-20 Richard Biener <rguenther@suse.de>
774 * genmatch.c (parse_simplify): Change inner if parsing, allow
776 (parse_pattern): Adjust.
777 * match.pd: Adjust inner ifs.
778 * match-builtin.pd: Likewise.
779 * match-comparison.pd: Likewise.
780 * match-constant-folding.pd: Likewise.
781 * match-plusminus.pd: Likewise.
782 * match-rotate.pd: Likewise.
784 2014-08-20 Richard Biener <rguenther@suse.de>
786 * match-comparison.pd (X * C1 CMP 0 -> X CMP 0): Fix, complete
789 2014-08-20 Richard Biener <rguenther@suse.de>
791 * genmatch.c (dt_node::get_expr_code, dt_node::is_gimple_expr,
792 dt_node::is_gimple_fn): Remove.
793 (dt_operand::kids_type, dt_operand::gtok_kids,
794 dt_operand::gen_generic_expr_expr, dt_operand::gen_generic_expr_fn):
796 (dt_operand::gen_gimple_expr_expr, dt_operand::gen_gimple_expr_fn):
798 (dt_operand::gen_gimple_expr): ... this new function.
799 (is_a_helper): More specializations.
800 (expr::gen_transform): Add missing newline.
801 (dt_operand::gen_gimple_kids): Rewrite to use switch statements.
802 (dt_operand::gen_generic_expr): Adjust.
803 (dt_operand::gen_gimple): Likewise.
805 2014-08-20 Richard Biener <rguenther@suse.de>
807 * gimple-fold.c (fold_stmt_1): Use gsi_replace_with_seq_vops
808 helper to insert gimple_simplify result.
810 2014-08-20 Richard Biener <rguenther@suse.de>
812 * match-comparison.pd (X * CST == 0 -> X == 0): Properly guard
813 with TYPE_OVERFLOW_UNDEFINED.
815 2014-08-19 Richard Biener <rguenther@suse.de>
817 * genmatch.c (dt_operand::gen_gimple): Remove excessive
819 (dt_operand::gen_generic): Likewise.
821 2014-08-19 Richard Biener <rguenther@suse.de>
823 * genmatch.c (decision_tree::gen_gimple): Use a switch statement
824 for the outermost level.
825 * gimple-match.h (code_helper::get_rep): New method.
827 2014-08-19 Richard Biener <rguenther@suse.de>
829 * genmatch.c (c_expr::output_code): New method.
830 (c_expr::gen_transform): Call it.
831 (outline_c_exprs): Likewise.
833 2014-08-19 Richard Biener <rguenther@suse.de>
835 * genmatch.c (is_a_helper): Provide specializations for
836 fn_id and operator_id.
837 (add_operator): Collect tcc_constant codes.
838 (commutate): Special-case zero-operand expressions.
839 (dt_node::get_expr_code): Likewise.
840 (parse_op): When parsing an id allow zero-operand operators
841 as predicates, parsing as expression, and disallow any other
843 * gimple-match-head.c (INTEGER_CST_P): Remove.
844 (REAL_CST_P): Likewise.
845 * match-bitwise.pd: Use INTEGER_CST instead of INTEGER_CST_P
846 and REAL_CST instead of REAL_CST_P.
847 * match-builtin.pd: Likewise.
848 * match-plusminus.pd: Likewise.
849 * match-rotate.pd: Likewise.
850 * match.pd: Likewise.
851 * match-comparison: Likewise.
853 2014-08-19 Richard Biener <rguenther@suse.de>
855 * genmatch.c (dt_simplify::gen_generic): Properly use the
856 specified type to generate the outermost expression.
858 2014-08-19 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
861 * gcc.dg/tree-ssa/match-constant-folding.c: Fix typo.
863 2014-08-18 Richard Biener <rguenther@suse.de>
865 * gimple-fold.c (gimple_build): Add function call overloads
866 with two and three arguments.
867 * gimple-fold.h (gimple_build): Likewise.
869 2014-08-18 Richard Biener <rguenther@suse.de>
871 * gimple-match-head.c (gimple_simplify): Handle calls with
874 2014-08-18 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
876 * match-constant-folding.c: Add new test-case.
878 2014-08-18 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
879 Richard Biener <rguenther@suse.de>
881 * match-comparison.pd: New file.
882 * match.pd: Include match-comparison.pd.
883 * genmatch.c (c_expr): Add vec<id_tab> member.
884 (replace_id): Handle replacing in c_exprs.
885 (c_expr::gen_transform): Handle replacing identifiers.
886 (outline_c_exprs): Likewise.
887 (parse_for): Replace in if-exprs.
889 2014-08-18 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
891 * doc/match-and-simplify.texi: Add documentation for capturing
892 expressions. Fix typo.
894 2014-08-18 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
897 * match-constant-folding.c: Add more test-cases.
899 2014-08-15 Richard Biener <rguenther@suse.de>
901 * gimple-match.h: New file.
902 * gimple-fold.c: Include gimple-match.h.
903 (fold_stmt_1): Use stmt-based gimple_simplify API.
904 (gimple_fold_stmt_to_constant_1): Likewise.
905 * gimple-match-head.c: Include gimple-match.h.
906 (class code_helper): Move to gimple-match.h.
907 (maybe_push_res_to_seq): Export.
908 (gimple_simplify): Likewise.
909 (gimple_simplify): New overload for functions with tree arguments.
910 (gimple_simplify): Remove gsi and SSA name overloads.
911 * gimple-fold.h (gimple_simplify): Remove gsi and SSA name
914 2014-08-13 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
917 * match-constant-folding.c: New test-case.
919 2014-08-12 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
921 * match.pd: Add new pattern.
924 * match.c: New test-case.
926 2014-08-12 Richard Biener <rguenther@suse.de>
928 * genmatch.c (main): Fix pasto.
930 2014-08-12 Richard Biener <rguenther@suse.de>
932 * genmatch.c (enum tree_code): Add CONVERT0.
934 (parse_operation): Handle conditional converts specially.
935 (lower_opt_convert): Handle CONVERT0.
936 (parse_for): Likewise.
938 2014-08-12 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
940 * genmatch.c (decision_tree::insert_operand): Adjust to allow
943 2014-08-11 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
945 * genmatch.c (enum tree_code): Add new values CONVERT1, CONVERT2.
946 (lower_opt_convert): New function.
947 (lower_opt_convert): New function overloaded.
948 (lower_opt_convert): Likewise.
949 (lower_opt_convert): Likewise.
950 (remove_opt_convert): New function.
951 (has_opt_convert): Likewise.
952 (decision_tree::insert_operand): Adjust for capturing a capture.
953 (parse_for): Reject CONVERT1, CONVERT2.
954 (main): call add_operator.
955 call lower_opt_convert.
957 2014-08-08 Richard Biener <rguenther@suse.de>
959 Merge from trunk r213455 through r213753.
961 2014-08-08 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
963 * genmatch.c (get_operator): New function.
964 (e_operation::e_operation): Adjust to call get_operator.
965 (parse_for): Add call to get_operator.
967 2014-08-07 Richard Biener <rguenther@suse.de>
969 * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Use
970 gimple_simplify instead of building a GENERIC call expr.
972 2014-08-06 Richard Biener <rguenther@suse.de>
974 * gimple-match-head.c (gimple_simplify): Fix implementation.
976 2014-08-06 Richard Biener <rguenther@suse.de>
978 * gimple-fold.h (gimple_simplify): Add two-parameter builtin
980 * gimple-match-head.c (gimple_simplify): Implement it.
982 2014-08-06 Richard Biener <rguenther@suse.de>
984 * gimple-fold.c (gimple_build): Allow to be called from
987 2014-08-06 Richard Biener <rguenther@suse.de>
989 * genmatch.c (gen_transform): Add depth parameter everywhere.
990 (expr::gen_transform): Make a depth dependent ops[] array
991 name and increase depth for siblings.
992 (gen_gimple, gen_generic): Pass 1 as depth to gen_transform
995 2014-08-06 Richard Biener <rguenther@suse.de>
997 * tree-ssa-forwprop.c (pass_forwprop::execute): Properly
998 clean EH info on folded stmts.
1000 2014-08-06 Richard Biener <rguenther@suse.de>
1002 * match-constant-folding.pd (minus @0 @0): Restrict to
1005 2014-08-06 Richard Biener <rguenther@suse.de>
1007 * tree-cfg.c (replace_uses_by): Clarify added comment.
1009 2014-08-06 Richard Biener <rguenther@suse.de>
1011 * tree-cfg.c (no_follow_ssa_edges): New function.
1012 (replace_uses_by): Do not follow SSA edges when folding the
1014 * gimple-match-head.c (maybe_push_res_to_seq): Disallow
1015 stmts that mention SSA names occuring in abnormal PHIs.
1016 (gimple_simplify): Likewise.
1018 2014-08-05 Richard Biener <rguenther@suse.de>
1020 * doc/match-and-simplify.texi: s/match_and_simplify/simplify/g
1021 * fold-const.c: Likewise.
1022 * genmatch.c: Likewise.
1023 * gimple-fold.c: Likewise.
1024 * gimple-fold.h: Likewise.
1025 * gimple-match-head.c: Likewise.
1026 * match-bitwise.pd: Likewise.
1027 * match-builtin.pd: Likewise.
1028 * match-constant-folding.pd: Likewise.
1029 * match-plusminus.pd: Likewise.
1030 * match-rotate.pd: Likewise.
1031 * match.pd: Likewise.
1032 * tree-ssa-forwprop.c: Likewise.
1033 * tree-ssa-sccvn.c: Likewise.
1035 * gimple-fold.c (fold_stmt): Add overload with valueize parameter.
1036 * gimple-fold.h (fold_stmt): Declare it.
1037 * tree-ssa-forwprop.c (pass_forwprop::execute): Use fold_stmt API.
1038 * tree-ssa-sccvn.c (try_to_simplify): Use
1039 gimple_fold_stmt_to_constant_1 API.
1041 * testsuite/gcc.dg/tree-ssa/match-1.c:
1042 s/match_and_simplified/simplified/g
1043 * testsuite/gcc.dg/tree-ssa/match-bitwise.c: Likewise
1044 * testsuite/gcc.dg/tree-ssa/match-plusminus.c: Likewise
1045 * testsuite/gcc.dg/tree-ssa/match-realimag.c: Likewise
1046 * testsuite/gcc.dg/tree-ssa/match-rotate.c: Likewise
1047 * testsuite/gcc.dg/tree-ssa/pr52631.c: Likewise
1049 2014-08-05 Richard Biener <rguenther@suse.de>
1051 * doc/match-and-simplify.texi: New file.
1052 * doc/gccint.texi: Include match-and-simplify.texi.
1053 * Makefile.in (TEXI_GCCINT_FILES): Add match-and-simplify.texi.
1055 2014-08-05 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1057 * genmatch.c (capture_max): Change value to 6.
1058 (match-plusminus.pd): Add new patterns.
1061 * gcc.dg/tree-ssa/match-plusminus.c (plusminus_9): New test-case.
1063 2014-08-04 Richard Biener <rguenther@suse.de>
1065 Merge from trunk r211444 through r213455.
1067 * genmatch.c (operators): Adjust for hash_table interface change.
1068 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children):
1069 Also fold non-call stmts inplace to avoid creating new SSA names.
1071 2014-08-04 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1073 * genmatch.c (dt_simplify::gen_gimple): Use dt_simplify::capture_max.
1074 (dt_simplify::gen_generic): Likewise.
1076 2014-07-31 Richard Biener <rguenther@suse.de>
1078 * Makefile.in (s-match): Fix dependencies.
1080 2014-07-31 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1082 * match-bitwise.pd: New file, split out from match.pd.
1083 * match-plusminus.pd: Likewise.
1084 * match-constant-folding.pd: Likewise.
1085 * match-builtin.pd: Likewise.
1086 * match-rotate.pd: Likewise.
1087 * match.pd: Move content to individual files based on
1088 pattern origin and include them.
1090 2014-07-30 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1092 * genmatch.c (print_operand): Adjust to use dyn_cast.
1094 2014-07-28 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1096 * genmatch.c (is-a.h): Include.
1097 (is_a_helper::test): Specialize for operand subclasses.
1098 (print_operand): Adjust to use is_a and as_a.
1100 2014-07-28 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1102 * genmatch.c (simplify::ifexpr): Remove.
1103 (simplify::ifexpr_location): Likewise.
1104 (simplify::simplify): Adjust to changes in simplify and
1105 add parameter ifexpr_vec_.
1106 (dt_simplify::gen_gimple): Adjust to changes in simplify.
1107 (dt_simplify::gen_generic): Likewise.
1108 (parse_if): New function.
1109 (parse_pattern): Add call to parse_if.
1111 * match.pd: Use outer-if for plus-minus patterns.
1113 2014-07-28 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1115 * genmatch.c (parse_for): Reject for that has no pattern defined.
1117 2014-07-23 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1119 * genmatch.c (parse_match_and_simplify): Adjust to parse
1121 (peek_ident): New function.
1122 * match.pd: Adjust patterns having if-expr to new syntax.
1124 2014-07-23 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1126 * genmatch.c (main): Remove unnecessary debug information.
1128 2014-07-23 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1130 * genmatch.c (parse_for): Adjust to parse multiple patterns.
1132 2014-07-17 Richard Biener <rguenther@suse.de>
1134 * gimple-fold.h (gimple_convert): Add overload with location_t
1136 (gimple_match_and_simplify): Mark overloads on tree and gsi
1139 2014-07-16 Richard Biener <rguenther@suse.de>
1141 * match.pd: Fix two patterns.
1143 2014-07-15 Richard Biener <rguenther@suse.de>
1145 * match.pd: Remove duplicated and broken rotate pattern.
1147 2014-07-15 Richard Biener <rguenther@suse.de>
1149 * genmatch.c (dt_operand::gen_match_op): Fall back to
1150 use operand_equal_p if literal equality does not hold.
1152 2014-07-15 Richard Biener <rguenther@suse.de>
1154 * genmatch.c (decision_tree::gen_generic): Guard against
1157 2014-07-15 Richard Biener <rguenther@suse.de>
1159 * genmatch.c (main): Add -v flag and guard debug dumps on it.
1161 2014-07-15 Richard Biener <rguenther@suse.de>
1163 * genmatch.c (decision_tree::gen_generic): Reject operands
1164 with TREE_SIDE_EFFECTS for now.
1165 (parse_for): Drop name of unused parameter.
1166 (main): Remove unused token.
1167 * match.pd: Remove ??? comment about TREE_SIDE_EFFECTS.
1169 2014-07-14 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1171 * match.pd: Remove INTEGRAL_TYPE_P (TREE_TYPE (@0)) in bitwise
1172 patterns and use integral_op_p@0.
1174 2014-07-14 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1176 * genmatch.c (print_operand): Add attribute DEBUG_FUNCTION.
1177 (print_matches): Likewise.
1178 (decision_tree::print_node): Likewise.
1179 (decision_tree::print): Likewise.
1181 2014-07-14 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1183 * genmatch.c (id_base::id_kind): Add new enum value USER_DEFINED.
1184 (e_operation::e_operation): New default argument add_new_id. Adjust
1185 to add id in hash table.
1186 (simplify): Remove matchers member. New member match.
1187 (print_matches): Adjust to changes in simplify.
1188 (decision_tree::insert): Likewise.
1189 (lower_commutative): New function.
1190 (check_operator): Likewise.
1191 (replace_id): Likewise.
1192 (eat_ident): Likewise.
1193 (parse_for): Likewise.
1194 (parse_pattern): Likewise.
1195 (check_no_user_id): Likewise.
1196 (check_no_user_id): Likewise, overloaded to take simplify as first
1198 (parse_expr): Call check_operator.
1199 (main): call parse_pattern, lower_commutative, check_no_user_id.
1200 * match.pd: Adjust few constant folding patterns to use for.
1203 * gcc.dg/tree-ssa/match-rotate.c: New test-case.
1205 2014-07-08 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1208 * gcc.dg/tree-ssa/match-2.c: Remove.
1209 * gcc.dg/tree-ssa/match-plusminus.c: New test-case.
1210 * gcc.dg/tree-ssa/match-bitwise.c: Likewise.
1211 * gcc.dg/tree-ssa/match-realimag.c: Likewise.
1213 2014-06-26 Richard Biener <rguenther@suse.de>
1215 * genmatch.c (c_expr::gen_transform): Fix unused parameter.
1216 (dt_simplify::gen_gimple): Mark captures as possibly unused.
1217 (dt_simplify::gen_generic): Likewise.
1218 (decision_tree::gen_generic): Mark type parameter as possibly
1221 2014-06-26 Richard Biener <rguenther@suse.de>
1223 * genmatch.c (dt_operand::gen_generic_kids): New function.
1224 (dt_operand::gen_generic_expr_expr): Conditionalize matching
1225 of code to GIMPLE code-gen.
1226 (dt_operand::gen_generic_expr_fn): Likewise.
1227 (dt_operand::gen_generic_expr): Adjust to close parens.
1228 (dt_operand::gen_generic): Call gen_generic_kids.
1229 (decision_tree::gen_generic): Likewise, use a switch stmt.
1231 2014-06-26 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1233 * genmatch.c (dt_node::get_expr_code): New member function.
1234 (dt_node::is_gimple_expr): Likewise.
1235 (dt_node::is_gimple_fn): Likewise.
1236 (dt_operand::kids_type): New struct.
1237 (dt_operand::gen_gimple_expr): Remove.
1238 (dt_operand::gen_gimple_expr_expr): Remove 2nd argument and
1239 change return type to unsigned. Adjust code-gen for expressions.
1240 (dt_operand::gen_gimple_expr_fn): Remove 2nd argument and change
1241 return type to unsigned.
1242 (dt_operand::grok_kids): New member function.
1243 (dt_operand::gen_gimple_kids): Likewise.
1244 (dt_operand::gen_gimple): Adjust code-gen for gimple expressions.
1245 Call dt_operand::gen_gimple_kids.
1246 (decision_tree::gen_gimple): Call dt_operand::gen_gimple_kids.
1248 2014-06-25 Richard Biener <rguenther@suse.de>
1250 * genmatch.c (decision_tree::gen_gimple): Create three
1251 gimple_match_and_simplify overloads again.
1252 (decision_tree::gen_generic): Likewise. Create final API
1253 with enum tree_code arguments.
1254 (main): Define GIMPLE or GENERIC dependent on code generation mode.
1255 * gimple-match-head.c (gimple_match_and_simplify): Adjust
1257 * match.pd: Disable P p+ CST -> &MEM[P, CST] transform for GENERIC.
1258 * fold-const.c (fold_unary_loc): First dispatch to
1259 generic_match_and_simplify.
1260 (fold_binary_loc): Likewise.
1261 (fold_ternary_loc): Likewise.
1263 2014-06-25 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1265 * genmatch.c (dt_operand::gen_gimple_predicate): Rename to ...
1266 (dt_operand::gen_predicate): ... this.
1267 (dt_operand::gen_gimple_match_op): Rename to ...
1268 (dt_operand::gen_match_op): ... this.
1270 2014-06-24 Richard Biener <rguenther@suse.de>
1272 * genmatch.c (operand::gen_gimple_transform): Rename to...
1273 (operand::gen_transform): ... this and add a flag argument for
1274 the kind of IL to generate.
1275 (predicate::gen_gimple_transform): Likewise.
1276 (expr::gen_gimple_transform): Likewise.
1277 (c_expr::gen_gimple_transform): Likewise.
1278 (capture::gen_gimple_transform): Likewise.
1279 (dt_node::gen_generic): Add.
1280 (dt_operand::gen_generic_expr): Add flag whether to valueize.
1281 (dt_operand::gen_generic_expr_expr): Likewise.
1282 (dt_operand::gen_generic_expr_fn): Likewise.
1283 (dt_simplify::gen_genric): Add.
1284 (decision_tree::gen_generic): Likewise.
1285 (main): Uncomment generic codegen.
1287 2014-06-24 Richard Biener <rguenther@suse.de>
1289 * genmatch.c (write_fn_prototype): Remove and inline...
1290 (decision_tree::gen_gimple): ...here.
1291 * gimple-match-head.c (gimple_match_and_simplify): Adjust
1292 operand order to put operands last. Make the last two
1293 default initialized to zero.
1294 (gimple_resimplify1): Adjust.
1295 (gimple_resimplify2): Likewise.
1296 (gimple_resimplify3): Likewise.
1297 (gimple_match_and_simplify): Likewise.
1299 2014-06-24 Richard Biener <rguenther@suse.de>
1301 * Makefile.in (OBJS): Add generic-match.o.
1302 (.PRECIOUS): Likewise.
1303 (MOSTLYCLEANFILES): Add generic-match.c.
1304 (generic-match.c): New rule.
1306 * generic-match-head.c: New file.
1307 * genmatch.c (write_gimple): Rename to ...
1308 (write_header): ... this and support generic-match.c creation.
1309 (main): Recognize -gimple and -generic switches and adjust
1312 2014-06-24 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1314 * genmatch.c (operand::gen_gimple_transform): Remove 2nd argument.
1315 (predicate::gen_gimple_transform): Likewise.
1316 (expr::gen_gimple_transform): Likewise.
1317 (c_expr::gen_gimple_transform): Likewise.
1318 (capture::gen_gimple_transform): Likewise.
1319 (dt_simplify::indexes): Change type to array of dt_operand *
1320 (dt_simplify::dt_simplify): change type of 3rd argument to dt_operand **
1321 (dt_simplify::gen_gimple): Remove 2nd argument in call to
1322 .gen_gimple_transform()
1323 (dt_operand::get_name): New member function.
1324 (dt_operand::gen_opname): New member function.
1325 (dt_operand::match_dop): New member.
1326 (dt_operand::temps): Remove.
1327 (dt_operand::temp_count): Likewise.
1328 (dt_operand::m_level): Likewise.
1329 (dt_operand::dt_operand): Change type of 2nd argument to dt_operand *
1330 (dt_operand::gen_gimple): Call get_name for getting operand name.
1331 (dt_operand::gen_gimple_expr_fn): Replace call to sprintf,
1332 by get_name (opname).
1333 (dt_operand::gen_gimple_expr_expr): Likwise.
1334 (dt_operand::gen_generic_expr_expr): Likewise.
1335 (dt_operand::gen_generic_expr_fn): Likewise
1336 (decision_tree::insert_operand): Change type of 3rd argument to
1338 (dt_node::append_simplify): Likewise.
1340 2014-06-23 Richard Biener <rguenther@suse.de>
1342 * match.pd (A - (A + B) -> - B): Fix and mark the inner
1343 addition as commutative.
1345 2014-06-23 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1347 * genmatch.c (gen_gimple_match_fail): Remove.
1348 (expr::gen_gimple_transform): Inline it here.
1350 2014-06-23 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1352 * match.pd: Mark commutative operators.
1354 2014-06-23 Richard Biener <rguenther@suse.de>
1356 * genmatch.c (operand::gen_gimple_match): Remove.
1357 (predicate::gen_gimple_match): Likewise.
1358 (expr::gen_gimple_match): Likewise.
1359 (c_expr::gen_gimple_match): Likewise.
1360 (capture::gen_gimple_match): Likewise.
1361 (write_nary_simplifiers): Remove.
1363 2014-06-23 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1365 * genmatch.c (print_operand): Add additional default argument bool
1367 (cmp_operand): New function to compare operands.
1368 (dt_node): New struct.
1369 (dt_operand): New struct.
1370 (dt_simplify): New struct.
1371 (decision_tree): New struct.
1372 (write_fn_prototype): New function to write
1373 gimple_match_and_simplify prototype.
1374 * gimple-match-head.c (do_valueize): New function.
1376 2014-06-23 Richard Biener <rguenther@suse.de>
1377 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1379 * match.pd: Remove commutated patterns in favor of :c annotations.
1380 * genmatch.c (e_operation): Add is_commutative flag.
1381 (e_operation::e_operation): Adjust.
1382 (simplify): Make match a vector of matches.
1383 (print_operand): New debug function.
1384 (print_matches): Likewise.
1385 (cartesian_product, commutate): New functions implementing
1387 (write_nary_simplifiers): Adjust to create code for all
1389 (parse_expr): Parse ':<flag>' with <flag> being c for
1391 (parse_match_and_simplify): Commutate the AST.
1392 (main): Print commutated simplifiers.
1394 2014-06-17 Richard Biener <rguenther@suse.de>
1396 * gimple-fold.c (gimple_fold_stmt_to_constant_1): Dump
1397 simplified expression.
1399 2014-06-11 Richard Biener <rguenther@suse.de>
1401 Merge from trunk r208477 through r211444.
1403 2014-06-11 Richard Biener <rguenther@suse.de>
1405 * genmatch.c (capture::gen_gimple_match): Whitespace fixes.
1406 (write_nary_simplifiers): Likewise.
1407 (outline_c_exprs): Likewise.
1408 (write_gimple): Write preamble.
1410 2014-06-05 Richard Biener <rguenther@suse.de>
1412 * genmatch.c (output_line_directive): New function.
1413 (struct simplify): Add locations for match, ifexpr and result.
1414 (write_nary_simplifiers): Annotate the source with line
1416 (parse_match_and_simplify): Record locations of match, ifexpr
1420 2014-06-05 Richard Biener <rguenther@suse.de>
1422 * match.pd: Fix bogus (~x & y) | x -> x & y transform which
1423 should have simplified to x | y.
1425 2014-06-05 Richard Biener <rguenther@suse.de>
1427 * gimple-match-head.c (gimple_resimplify2): Verify constant
1428 folded result is really constant.
1429 (gimple_match_and_simplify): Likewise. Bail out for internal
1431 * match.pd: Match what fold-const.c does for folding of
1432 division and modulo with regarding to possibly zero 2nd operand.
1433 Add comment to bogus pow (x, 0.5) to sqrt (x) simplification.
1435 2014-06-04 Richard Biener <rguenther@suse.de>
1437 * Makefile.in (gimple-match.o-warn): Drop.
1438 * genmatch.c (*::gen_gimple_transform): Add destination argument
1439 and use that to store the result to. Drop stmt expression use.
1440 (write_nary_simplifiers): Adjust.
1441 * gimple-match-head.c (gimple_resimplify1): Initialize tem.
1442 (gimple_resimplify2): Likewise.
1443 (gimple_resimplify3): Likewise.
1445 2014-06-04 Richard Biener <rguenther@suse.de>
1447 * genmatch.c (c_expr): Record cpp_tokens, the number of
1448 stmts seen and a function identifier.
1449 (c_expr::gen_gimple_transform): Generate textual form
1450 from the token vector or a call to the outlined function.
1451 (write_nary_simplifiers): Adjust.
1452 (outline_c_exprs): New function.
1453 (write_gimple): Call it.
1454 (parse_c_expr): Record a cpp_token vector.
1456 2014-06-04 Richard Biener <rguenther@suse.de>
1458 * gimple-match-head.c (gimple_match_and_simplify): Fix cut&paste
1461 2014-06-04 Richard Biener <rguenther@suse.de>
1463 * genmatch.c (error_cb, fatal_at): Annotate with printf
1464 format attribute to silence warning.
1465 * gimple-match-head.c (gimple_resimplify1): Check for
1466 builtin availability and properly zero out excess operands.
1467 (gimple_resimplify2): Likewise.
1468 (gimple_resimplify3): Likewise.
1469 (maybe_push_res_to_seq): Check for builtin availability.
1470 (gimple_match_and_simplify): Likewise.
1472 2014-06-03 Richard Biener <rguenther@suse.de>
1474 * match.pd: Generalize ~A + A -> -1 simplification to all
1477 2014-06-02 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1478 Richard Biener <rguenther@suse.de>
1480 * match.pd: Add few patterns from simplify_bitwise_binary.
1482 * gcc.dg/tree-ssa/match-2.c: Add more test-cases.
1484 2014-06-02 Richard Biener <rguenther@suse.de>
1486 * gimple-fold.c (gimple_fold_stmt_to_constant_1): Rename to ....
1487 (gimple_fold_stmt_to_constant_2): ... this and make static.
1488 (gimple_fold_stmt_to_constant_1): New wrapper using
1489 gimple_match_and_simplify before falling back to
1490 gimple_fold_stmt_to_constant_2.
1491 * match.pd: Add basic constant folding patterns. Add
1494 2014-05-21 Richard Biener <rguenther@suse.de>
1496 * gimple-match-head.c (constant_for_folding): New function.
1497 (gimple_resimplify1, gimple_resimplify2, gimple_resimplify3):
1498 Use it. Strip NOPs from call stmt constant folding results
1499 and return whether we re-simplified anything.
1500 (maybe_push_res_to_seq): Allow is_gimple_val ADDR_EXPRs
1502 (gimple_match_and_simplify): Use constant_for_folding,
1503 Strip NOPs from call stmt constant folding results.
1504 (gimple_match_and_simplify): Use gimple_resimplify1 for the
1505 stmt overload to get constant folding and argument
1506 canonicalization. Simplify SSA name copies.
1507 (gimple_match_and_simplify): Valueize from a copy or
1508 constant assignment for the SSA name overload.
1510 2014-05-20 Richard Biener <rguenther@suse.de>
1512 * genmatch.c (error_cb, fatal_at): New functions.
1513 (expect, parse_expr, parse_op, parse_match_and_simplify,
1514 main): Provide error locations.
1516 2014-05-20 Richard Biener <rguenther@suse.de>
1518 * genmatch.c (parse_match_and_simplify): Reject outermost
1519 expressions that are captured or not expressions.
1520 * match.pd: Rewrite negate contracting patterns to avoid
1521 capturing the outermost expression.
1523 2014-05-15 Richard Biener <rguenther@suse.de>
1525 * gimple-fold.c (fold_stmt_1): Dispatch to
1526 gimple_match_and_simplify.
1528 2014-05-15 Richard Biener <rguenther@suse.de>
1530 * genmatch.c (expr::gen_gimple_match): Fix variable
1531 shadowing, remove unused decl.
1533 2014-05-15 Richard Biener <rguenther@suse.de>
1535 * genmatch.c (expr::gen_gimple_match): Handle NOP_EXPR
1536 and CONVERT_EXPR interchangably.
1538 2014-05-14 Richard Biener <rguenther@suse.de>
1540 * gimple-match-head.c (REAL_CST_P): New predicate.
1541 (gimple_match_and_simplify): Support re-simplification of
1542 two-argument builtin functions.
1543 * match.pd: Add pattern simplifying pow (x, 0.5) to sqrt (x).
1546 * gcc.dg/tree-ssa/match-1.c: Add testcase involving two-argument
1547 function re-simplification.
1549 2014-05-14 Richard Biener <rguenther@suse.de>
1551 * gimple-match-head.c (maybe_push_res_to_seq): Fix res
1552 != NULL case and add a comment.
1553 (gimple_match_and_simplify): Properly handle virtual
1554 operands when we replace the stmt on the gsi interface.
1556 2014-04-02 Richard Biener <rguenther@suse.de>
1558 Merge from trunk r208477 through r209020.
1560 2014-03-17 Richard Biener <rguenther@suse.de>
1562 * Makefile.in (gimple-match.o-warn): Temporarily add -fpermissive
1563 to allow bootstrapping.
1565 2014-03-17 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
1567 * genmatch.c (c_expr::c_expr): use OP_C_EXPR instead of OP_EXPR in
1568 call to operand constructor.
1570 2014-03-13 Richard Biener <rguenther@suse.de>
1572 * match.pd: Add pattern matching a call in a sub-expression.
1573 * genmatch.c (expr::gen_gimple_match): Complete call handling.
1574 Support matching GENERIC.
1577 * gcc.dg/tree-ssa/match-1.c: Adjust.
1579 2014-03-13 Richard Biener <rguenther@suse.de>
1581 * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine):
1582 Split out combining with gimple_match_and_simplify to a
1583 separate "pass". Implement a lattice.
1585 2014-03-13 Richard Biener <rguenther@suse.de>
1587 * gimple-match-head.c (gimple_resimplify2, gimple_resimplify3):
1588 Implement missing call handling.
1589 (gimple_match_and_simplify): Fix lhs gathering.
1591 2014-03-13 Richard Biener <rguenther@suse.de>
1593 * genmatch.c (expr::gen_gimple_transform): Make sure to
1594 try simplifying a transform pattern even when seq is NULL
1595 as seq may not be needed.
1597 2014-03-11 Richard Biener <rguenther@suse.de>
1599 * tree-ssa-sccvn.h (struct vn_ssa_aux): Remove has_constants
1601 * tree-ssa-sccvn.c (vn_get_expr_for): Simplify for legacy PRE use.
1602 (visit_copy): Do not set or use has_constants or expr.
1603 (visit_reference_op_call): Likewise.
1604 (visit_phi): Likewise.
1605 (visit_use): Likewise.
1606 (visit_reference_op_load): Simplify result using
1607 gimple_match_and_simplify.
1608 (expr_has_constants, stmt_has_constants, valueize_expr,
1609 simplify_binary_expression, simplify_unary_expression): Remove.
1610 (try_to_simplify): Do not use gimple_fold_stmt_to_constant_1.
1612 2014-03-11 Richard Biener <rguenther@suse.de>
1614 * gimple-fold.c (gimple_build): Move constant folding and
1615 operand order canonicalization ...
1616 * gimple-match-head.c (gimple_match_and_simplify): ... here.
1618 2014-03-11 Richard Biener <rguenther@suse.de>
1620 * genmatch.c: New generator progam.
1621 * match.pd: New file with match-and-simplify patterns.
1622 * gimple-match-head.c: Header of generated gimple-match.c.
1623 * gimple-fold.h (gimple_build): New API for a GIMPLE
1624 variant of fold_buildN.
1625 (gimple_convert): Likewise.
1626 (gimple_match_and_simplify): Declare.
1628 * tree-ssa-sccvn.c (try_to_simplify): Make use of
1629 gimple_match_and_simplify.
1630 * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine):
1631 Make use of gimple_match_and_simplify.
1632 * tree-ssa-pre.c: Make use of gimple_build and get rid
1633 of force_gimple_operand uses.
1635 * hash-table.c: Allow to be used in generator programs.
1636 * builtins.c (fold_builtin_n): Export.
1637 * tree.h (fold_builtin_n): Declare.
1639 * gcc.dg/tree-ssa/match-1.c: A little testcase.