1 /* Reassociation for trees.
2 Copyright (C) 2005, 2007 Free Software Foundation, Inc.
3 Contributed by Daniel Berlin <dan@dberlin.org>
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
23 #include "coretypes.h"
28 #include "basic-block.h"
29 #include "diagnostic.h"
30 #include "tree-inline.h"
31 #include "tree-flow.h"
32 #include "tree-gimple.h"
33 #include "tree-dump.h"
35 #include "tree-iterator.h"
36 #include "tree-pass.h"
37 #include "alloc-pool.h"
39 #include "langhooks.h"
40 #include "pointer-set.h"
43 /* This is a simple global reassociation pass. It is, in part, based
44 on the LLVM pass of the same name (They do some things more/less
45 than we do, in different orders, etc).
47 It consists of five steps:
49 1. Breaking up subtract operations into addition + negate, where
50 it would promote the reassociation of adds.
52 2. Left linearization of the expression trees, so that (A+B)+(C+D)
53 becomes (((A+B)+C)+D), which is easier for us to rewrite later.
54 During linearization, we place the operands of the binary
55 expressions into a vector of operand_entry_t
57 3. Optimization of the operand lists, eliminating things like a +
60 4. Rewrite the expression trees we linearized and optimized so
61 they are in proper rank order.
63 5. Repropagate negates, as nothing else will clean it up ATM.
65 A bit of theory on #4, since nobody seems to write anything down
66 about why it makes sense to do it the way they do it:
68 We could do this much nicer theoretically, but don't (for reasons
69 explained after how to do it theoretically nice :P).
71 In order to promote the most redundancy elimination, you want
72 binary expressions whose operands are the same rank (or
73 preferably, the same value) exposed to the redundancy eliminator,
74 for possible elimination.
76 So the way to do this if we really cared, is to build the new op
77 tree from the leaves to the roots, merging as you go, and putting the
78 new op on the end of the worklist, until you are left with one
79 thing on the worklist.
81 IE if you have to rewrite the following set of operands (listed with
82 rank in parentheses), with opcode PLUS_EXPR:
84 a (1), b (1), c (1), d (2), e (2)
87 We start with our merge worklist empty, and the ops list with all of
90 You want to first merge all leaves of the same rank, as much as
93 So first build a binary op of
95 mergetmp = a + b, and put "mergetmp" on the merge worklist.
97 Because there is no three operand form of PLUS_EXPR, c is not going to
98 be exposed to redundancy elimination as a rank 1 operand.
100 So you might as well throw it on the merge worklist (you could also
101 consider it to now be a rank two operand, and merge it with d and e,
102 but in this case, you then have evicted e from a binary op. So at
103 least in this situation, you can't win.)
105 Then build a binary op of d + e
108 and put mergetmp2 on the merge worklist.
110 so merge worklist = {mergetmp, c, mergetmp2}
112 Continue building binary ops of these operations until you have only
113 one operation left on the worklist.
118 mergetmp3 = mergetmp + c
120 worklist = {mergetmp2, mergetmp3}
122 mergetmp4 = mergetmp2 + mergetmp3
124 worklist = {mergetmp4}
126 because we have one operation left, we can now just set the original
127 statement equal to the result of that operation.
129 This will at least expose a + b and d + e to redundancy elimination
130 as binary operations.
132 For extra points, you can reuse the old statements to build the
133 mergetmps, since you shouldn't run out.
135 So why don't we do this?
137 Because it's expensive, and rarely will help. Most trees we are
138 reassociating have 3 or less ops. If they have 2 ops, they already
139 will be written into a nice single binary op. If you have 3 ops, a
140 single simple check suffices to tell you whether the first two are of the
141 same rank. If so, you know to order it
144 newstmt = mergetmp + op3
148 newstmt = mergetmp + op1
150 If all three are of the same rank, you can't expose them all in a
151 single binary operator anyway, so the above is *still* the best you
154 Thus, this is what we do. When we have three ops left, we check to see
155 what order to put them in, and call it a day. As a nod to vector sum
156 reduction, we check if any of ops are a really a phi node that is a
157 destructive update for the associating op, and keep the destructive
158 update together for vector sum reduction recognition. */
165 int constants_eliminated
;
170 /* Operator, rank pair. */
171 typedef struct operand_entry
177 static alloc_pool operand_entry_pool
;
180 /* Starting rank number for a given basic block, so that we can rank
181 operations using unmovable instructions in that BB based on the bb
183 static long *bb_rank
;
185 /* Operand->rank hashtable. */
186 static struct pointer_map_t
*operand_rank
;
189 /* Look up the operand rank structure for expression E. */
192 find_operand_rank (tree e
)
194 void **slot
= pointer_map_contains (operand_rank
, e
);
195 return slot
? (long) *slot
: -1;
198 /* Insert {E,RANK} into the operand rank hashtable. */
201 insert_operand_rank (tree e
, long rank
)
204 gcc_assert (rank
> 0);
205 slot
= pointer_map_insert (operand_rank
, e
);
207 *slot
= (void *) rank
;
210 /* Given an expression E, return the rank of the expression. */
215 /* Constants have rank 0. */
216 if (is_gimple_min_invariant (e
))
219 /* SSA_NAME's have the rank of the expression they are the result
221 For globals and uninitialized values, the rank is 0.
222 For function arguments, use the pre-setup rank.
223 For PHI nodes, stores, asm statements, etc, we use the rank of
225 For simple operations, the rank is the maximum rank of any of
226 its operands, or the bb_rank, whichever is less.
227 I make no claims that this is optimal, however, it gives good
230 if (TREE_CODE (e
) == SSA_NAME
)
238 if (TREE_CODE (SSA_NAME_VAR (e
)) == PARM_DECL
239 && SSA_NAME_IS_DEFAULT_DEF (e
))
240 return find_operand_rank (e
);
242 stmt
= SSA_NAME_DEF_STMT (e
);
243 if (bb_for_stmt (stmt
) == NULL
)
246 if (TREE_CODE (stmt
) != GIMPLE_MODIFY_STMT
247 || !ZERO_SSA_OPERANDS (stmt
, SSA_OP_VIRTUAL_DEFS
))
248 return bb_rank
[bb_for_stmt (stmt
)->index
];
250 /* If we already have a rank for this expression, use that. */
251 rank
= find_operand_rank (e
);
255 /* Otherwise, find the maximum rank for the operands, or the bb
256 rank, whichever is less. */
258 maxrank
= bb_rank
[bb_for_stmt(stmt
)->index
];
259 rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
260 n
= TREE_OPERAND_LENGTH (rhs
);
262 rank
= MAX (rank
, get_rank (rhs
));
267 && TREE_OPERAND (rhs
, i
)
270 rank
= MAX(rank
, get_rank (TREE_OPERAND (rhs
, i
)));
273 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
275 fprintf (dump_file
, "Rank for ");
276 print_generic_expr (dump_file
, e
, 0);
277 fprintf (dump_file
, " is %ld\n", (rank
+ 1));
280 /* Note the rank in the hashtable so we don't recompute it. */
281 insert_operand_rank (e
, (rank
+ 1));
285 /* Globals, etc, are rank 0 */
289 DEF_VEC_P(operand_entry_t
);
290 DEF_VEC_ALLOC_P(operand_entry_t
, heap
);
292 /* We want integer ones to end up last no matter what, since they are
293 the ones we can do the most with. */
294 #define INTEGER_CONST_TYPE 1 << 3
295 #define FLOAT_CONST_TYPE 1 << 2
296 #define OTHER_CONST_TYPE 1 << 1
298 /* Classify an invariant tree into integer, float, or other, so that
299 we can sort them to be near other constants of the same type. */
301 constant_type (tree t
)
303 if (INTEGRAL_TYPE_P (TREE_TYPE (t
)))
304 return INTEGER_CONST_TYPE
;
305 else if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (t
)))
306 return FLOAT_CONST_TYPE
;
308 return OTHER_CONST_TYPE
;
311 /* qsort comparison function to sort operand entries PA and PB by rank
312 so that the sorted array is ordered by rank in decreasing order. */
314 sort_by_operand_rank (const void *pa
, const void *pb
)
316 const operand_entry_t oea
= *(const operand_entry_t
*)pa
;
317 const operand_entry_t oeb
= *(const operand_entry_t
*)pb
;
319 /* It's nicer for optimize_expression if constants that are likely
320 to fold when added/multiplied//whatever are put next to each
321 other. Since all constants have rank 0, order them by type. */
322 if (oeb
->rank
== 0 && oea
->rank
== 0)
323 return constant_type (oeb
->op
) - constant_type (oea
->op
);
325 /* Lastly, make sure the versions that are the same go next to each
326 other. We use SSA_NAME_VERSION because it's stable. */
327 if ((oeb
->rank
- oea
->rank
== 0)
328 && TREE_CODE (oea
->op
) == SSA_NAME
329 && TREE_CODE (oeb
->op
) == SSA_NAME
)
330 return SSA_NAME_VERSION (oeb
->op
) - SSA_NAME_VERSION (oea
->op
);
332 return oeb
->rank
- oea
->rank
;
335 /* Add an operand entry to *OPS for the tree operand OP. */
338 add_to_ops_vec (VEC(operand_entry_t
, heap
) **ops
, tree op
)
340 operand_entry_t oe
= (operand_entry_t
) pool_alloc (operand_entry_pool
);
343 oe
->rank
= get_rank (op
);
344 VEC_safe_push (operand_entry_t
, heap
, *ops
, oe
);
347 /* Return true if STMT is reassociable operation containing a binary
348 operation with tree code CODE, and is inside LOOP. */
351 is_reassociable_op (tree stmt
, enum tree_code code
, struct loop
*loop
)
355 if (IS_EMPTY_STMT (stmt
))
358 bb
= bb_for_stmt (stmt
);
359 if (!flow_bb_inside_loop_p (loop
, bb
))
362 if (TREE_CODE (stmt
) == GIMPLE_MODIFY_STMT
363 && TREE_CODE (GIMPLE_STMT_OPERAND (stmt
, 1)) == code
364 && has_single_use (GIMPLE_STMT_OPERAND (stmt
, 0)))
370 /* Given NAME, if NAME is defined by a unary operation OPCODE, return the
371 operand of the negate operation. Otherwise, return NULL. */
374 get_unary_op (tree name
, enum tree_code opcode
)
376 tree stmt
= SSA_NAME_DEF_STMT (name
);
379 if (TREE_CODE (stmt
) != GIMPLE_MODIFY_STMT
)
382 rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
383 if (TREE_CODE (rhs
) == opcode
)
384 return TREE_OPERAND (rhs
, 0);
388 /* If CURR and LAST are a pair of ops that OPCODE allows us to
389 eliminate through equivalences, do so, remove them from OPS, and
390 return true. Otherwise, return false. */
393 eliminate_duplicate_pair (enum tree_code opcode
,
394 VEC (operand_entry_t
, heap
) **ops
,
397 operand_entry_t curr
,
398 operand_entry_t last
)
401 /* If we have two of the same op, and the opcode is & |, min, or max,
402 we can eliminate one of them.
403 If we have two of the same op, and the opcode is ^, we can
404 eliminate both of them. */
406 if (last
&& last
->op
== curr
->op
)
414 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
416 fprintf (dump_file
, "Equivalence: ");
417 print_generic_expr (dump_file
, curr
->op
, 0);
418 fprintf (dump_file
, " [&|minmax] ");
419 print_generic_expr (dump_file
, last
->op
, 0);
420 fprintf (dump_file
, " -> ");
421 print_generic_stmt (dump_file
, last
->op
, 0);
424 VEC_ordered_remove (operand_entry_t
, *ops
, i
);
425 reassociate_stats
.ops_eliminated
++;
430 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
432 fprintf (dump_file
, "Equivalence: ");
433 print_generic_expr (dump_file
, curr
->op
, 0);
434 fprintf (dump_file
, " ^ ");
435 print_generic_expr (dump_file
, last
->op
, 0);
436 fprintf (dump_file
, " -> nothing\n");
439 reassociate_stats
.ops_eliminated
+= 2;
441 if (VEC_length (operand_entry_t
, *ops
) == 2)
443 VEC_free (operand_entry_t
, heap
, *ops
);
445 add_to_ops_vec (ops
, fold_convert (TREE_TYPE (last
->op
),
451 VEC_ordered_remove (operand_entry_t
, *ops
, i
-1);
452 VEC_ordered_remove (operand_entry_t
, *ops
, i
-1);
464 /* If OPCODE is PLUS_EXPR, CURR->OP is really a negate expression,
465 look in OPS for a corresponding positive operation to cancel it
466 out. If we find one, remove the other from OPS, replace
467 OPS[CURRINDEX] with 0, and return true. Otherwise, return
471 eliminate_plus_minus_pair (enum tree_code opcode
,
472 VEC (operand_entry_t
, heap
) **ops
,
473 unsigned int currindex
,
474 operand_entry_t curr
)
480 if (opcode
!= PLUS_EXPR
|| TREE_CODE (curr
->op
) != SSA_NAME
)
483 negateop
= get_unary_op (curr
->op
, NEGATE_EXPR
);
484 if (negateop
== NULL_TREE
)
487 /* Any non-negated version will have a rank that is one less than
488 the current rank. So once we hit those ranks, if we don't find
491 for (i
= currindex
+ 1;
492 VEC_iterate (operand_entry_t
, *ops
, i
, oe
)
493 && oe
->rank
>= curr
->rank
- 1 ;
496 if (oe
->op
== negateop
)
499 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
501 fprintf (dump_file
, "Equivalence: ");
502 print_generic_expr (dump_file
, negateop
, 0);
503 fprintf (dump_file
, " + -");
504 print_generic_expr (dump_file
, oe
->op
, 0);
505 fprintf (dump_file
, " -> 0\n");
508 VEC_ordered_remove (operand_entry_t
, *ops
, i
);
509 add_to_ops_vec (ops
, fold_convert(TREE_TYPE (oe
->op
),
511 VEC_ordered_remove (operand_entry_t
, *ops
, currindex
);
512 reassociate_stats
.ops_eliminated
++;
521 /* If OPCODE is BIT_IOR_EXPR, BIT_AND_EXPR, and, CURR->OP is really a
522 bitwise not expression, look in OPS for a corresponding operand to
523 cancel it out. If we find one, remove the other from OPS, replace
524 OPS[CURRINDEX] with 0, and return true. Otherwise, return
528 eliminate_not_pairs (enum tree_code opcode
,
529 VEC (operand_entry_t
, heap
) **ops
,
530 unsigned int currindex
,
531 operand_entry_t curr
)
537 if ((opcode
!= BIT_IOR_EXPR
&& opcode
!= BIT_AND_EXPR
)
538 || TREE_CODE (curr
->op
) != SSA_NAME
)
541 notop
= get_unary_op (curr
->op
, BIT_NOT_EXPR
);
542 if (notop
== NULL_TREE
)
545 /* Any non-not version will have a rank that is one less than
546 the current rank. So once we hit those ranks, if we don't find
549 for (i
= currindex
+ 1;
550 VEC_iterate (operand_entry_t
, *ops
, i
, oe
)
551 && oe
->rank
>= curr
->rank
- 1;
556 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
558 fprintf (dump_file
, "Equivalence: ");
559 print_generic_expr (dump_file
, notop
, 0);
560 if (opcode
== BIT_AND_EXPR
)
561 fprintf (dump_file
, " & ~");
562 else if (opcode
== BIT_IOR_EXPR
)
563 fprintf (dump_file
, " | ~");
564 print_generic_expr (dump_file
, oe
->op
, 0);
565 if (opcode
== BIT_AND_EXPR
)
566 fprintf (dump_file
, " -> 0\n");
567 else if (opcode
== BIT_IOR_EXPR
)
568 fprintf (dump_file
, " -> -1\n");
571 if (opcode
== BIT_AND_EXPR
)
572 oe
->op
= fold_convert (TREE_TYPE (oe
->op
), integer_zero_node
);
573 else if (opcode
== BIT_IOR_EXPR
)
574 oe
->op
= build_low_bits_mask (TREE_TYPE (oe
->op
),
575 TYPE_PRECISION (TREE_TYPE (oe
->op
)));
577 reassociate_stats
.ops_eliminated
578 += VEC_length (operand_entry_t
, *ops
) - 1;
579 VEC_free (operand_entry_t
, heap
, *ops
);
581 VEC_safe_push (operand_entry_t
, heap
, *ops
, oe
);
589 /* Use constant value that may be present in OPS to try to eliminate
590 operands. Note that this function is only really used when we've
591 eliminated ops for other reasons, or merged constants. Across
592 single statements, fold already does all of this, plus more. There
593 is little point in duplicating logic, so I've only included the
594 identities that I could ever construct testcases to trigger. */
597 eliminate_using_constants (enum tree_code opcode
,
598 VEC(operand_entry_t
, heap
) **ops
)
600 operand_entry_t oelast
= VEC_last (operand_entry_t
, *ops
);
602 if (oelast
->rank
== 0 && INTEGRAL_TYPE_P (TREE_TYPE (oelast
->op
)))
607 if (integer_zerop (oelast
->op
))
609 if (VEC_length (operand_entry_t
, *ops
) != 1)
611 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
612 fprintf (dump_file
, "Found & 0, removing all other ops\n");
614 reassociate_stats
.ops_eliminated
615 += VEC_length (operand_entry_t
, *ops
) - 1;
617 VEC_free (operand_entry_t
, heap
, *ops
);
619 VEC_safe_push (operand_entry_t
, heap
, *ops
, oelast
);
623 else if (integer_all_onesp (oelast
->op
))
625 if (VEC_length (operand_entry_t
, *ops
) != 1)
627 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
628 fprintf (dump_file
, "Found & -1, removing\n");
629 VEC_pop (operand_entry_t
, *ops
);
630 reassociate_stats
.ops_eliminated
++;
635 if (integer_all_onesp (oelast
->op
))
637 if (VEC_length (operand_entry_t
, *ops
) != 1)
639 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
640 fprintf (dump_file
, "Found | -1, removing all other ops\n");
642 reassociate_stats
.ops_eliminated
643 += VEC_length (operand_entry_t
, *ops
) - 1;
645 VEC_free (operand_entry_t
, heap
, *ops
);
647 VEC_safe_push (operand_entry_t
, heap
, *ops
, oelast
);
651 else if (integer_zerop (oelast
->op
))
653 if (VEC_length (operand_entry_t
, *ops
) != 1)
655 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
656 fprintf (dump_file
, "Found | 0, removing\n");
657 VEC_pop (operand_entry_t
, *ops
);
658 reassociate_stats
.ops_eliminated
++;
663 if (integer_zerop (oelast
->op
))
665 if (VEC_length (operand_entry_t
, *ops
) != 1)
667 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
668 fprintf (dump_file
, "Found * 0, removing all other ops\n");
670 reassociate_stats
.ops_eliminated
671 += VEC_length (operand_entry_t
, *ops
) - 1;
672 VEC_free (operand_entry_t
, heap
, *ops
);
674 VEC_safe_push (operand_entry_t
, heap
, *ops
, oelast
);
678 else if (integer_onep (oelast
->op
))
680 if (VEC_length (operand_entry_t
, *ops
) != 1)
682 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
683 fprintf (dump_file
, "Found * 1, removing\n");
684 VEC_pop (operand_entry_t
, *ops
);
685 reassociate_stats
.ops_eliminated
++;
693 if (integer_zerop (oelast
->op
))
695 if (VEC_length (operand_entry_t
, *ops
) != 1)
697 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
698 fprintf (dump_file
, "Found [|^+] 0, removing\n");
699 VEC_pop (operand_entry_t
, *ops
);
700 reassociate_stats
.ops_eliminated
++;
711 /* Perform various identities and other optimizations on the list of
712 operand entries, stored in OPS. The tree code for the binary
713 operation between all the operands is OPCODE. */
716 optimize_ops_list (enum tree_code opcode
,
717 VEC (operand_entry_t
, heap
) **ops
)
719 unsigned int length
= VEC_length (operand_entry_t
, *ops
);
722 operand_entry_t oelast
= NULL
;
723 bool iterate
= false;
728 oelast
= VEC_last (operand_entry_t
, *ops
);
730 /* If the last two are constants, pop the constants off, merge them
731 and try the next two. */
732 if (oelast
->rank
== 0 && is_gimple_min_invariant (oelast
->op
))
734 operand_entry_t oelm1
= VEC_index (operand_entry_t
, *ops
, length
- 2);
737 && is_gimple_min_invariant (oelm1
->op
)
738 && useless_type_conversion_p (TREE_TYPE (oelm1
->op
),
739 TREE_TYPE (oelast
->op
)))
741 tree folded
= fold_binary (opcode
, TREE_TYPE (oelm1
->op
),
742 oelm1
->op
, oelast
->op
);
744 if (folded
&& is_gimple_min_invariant (folded
))
746 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
747 fprintf (dump_file
, "Merging constants\n");
749 VEC_pop (operand_entry_t
, *ops
);
750 VEC_pop (operand_entry_t
, *ops
);
752 add_to_ops_vec (ops
, folded
);
753 reassociate_stats
.constants_eliminated
++;
755 optimize_ops_list (opcode
, ops
);
761 eliminate_using_constants (opcode
, ops
);
764 for (i
= 0; VEC_iterate (operand_entry_t
, *ops
, i
, oe
);)
768 if (eliminate_not_pairs (opcode
, ops
, i
, oe
))
770 if (eliminate_duplicate_pair (opcode
, ops
, &done
, i
, oe
, oelast
)
771 || (!done
&& eliminate_plus_minus_pair (opcode
, ops
, i
, oe
)))
783 length
= VEC_length (operand_entry_t
, *ops
);
784 oelast
= VEC_last (operand_entry_t
, *ops
);
787 optimize_ops_list (opcode
, ops
);
790 /* Return true if OPERAND is defined by a PHI node which uses the LHS
791 of STMT in it's operands. This is also known as a "destructive
792 update" operation. */
795 is_phi_for_stmt (tree stmt
, tree operand
)
798 tree lhs
= GIMPLE_STMT_OPERAND (stmt
, 0);
802 if (TREE_CODE (operand
) != SSA_NAME
)
805 def_stmt
= SSA_NAME_DEF_STMT (operand
);
806 if (TREE_CODE (def_stmt
) != PHI_NODE
)
809 FOR_EACH_PHI_ARG (arg_p
, def_stmt
, i
, SSA_OP_USE
)
810 if (lhs
== USE_FROM_PTR (arg_p
))
815 /* Recursively rewrite our linearized statements so that the operators
816 match those in OPS[OPINDEX], putting the computation in rank
820 rewrite_expr_tree (tree stmt
, unsigned int opindex
,
821 VEC(operand_entry_t
, heap
) * ops
)
823 tree rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
826 /* If we have three operands left, then we want to make sure the one
827 that gets the double binary op are the ones with the same rank.
829 The alternative we try is to see if this is a destructive
830 update style statement, which is like:
833 In that case, we want to use the destructive update form to
834 expose the possible vectorizer sum reduction opportunity.
835 In that case, the third operand will be the phi node.
837 We could, of course, try to be better as noted above, and do a
838 lot of work to try to find these opportunities in >3 operand
839 cases, but it is unlikely to be worth it. */
840 if (opindex
+ 3 == VEC_length (operand_entry_t
, ops
))
842 operand_entry_t oe1
, oe2
, oe3
;
844 oe1
= VEC_index (operand_entry_t
, ops
, opindex
);
845 oe2
= VEC_index (operand_entry_t
, ops
, opindex
+ 1);
846 oe3
= VEC_index (operand_entry_t
, ops
, opindex
+ 2);
848 if ((oe1
->rank
== oe2
->rank
849 && oe2
->rank
!= oe3
->rank
)
850 || (is_phi_for_stmt (stmt
, oe3
->op
)
851 && !is_phi_for_stmt (stmt
, oe1
->op
)
852 && !is_phi_for_stmt (stmt
, oe2
->op
)))
854 struct operand_entry temp
= *oe3
;
856 oe3
->rank
= oe1
->rank
;
858 oe1
->rank
= temp
.rank
;
862 /* The final recursion case for this function is that you have
863 exactly two operations left.
864 If we had one exactly one op in the entire list to start with, we
865 would have never called this function, and the tail recursion
866 rewrites them one at a time. */
867 if (opindex
+ 2 == VEC_length (operand_entry_t
, ops
))
869 operand_entry_t oe1
, oe2
;
871 oe1
= VEC_index (operand_entry_t
, ops
, opindex
);
872 oe2
= VEC_index (operand_entry_t
, ops
, opindex
+ 1);
874 if (TREE_OPERAND (rhs
, 0) != oe1
->op
875 || TREE_OPERAND (rhs
, 1) != oe2
->op
)
878 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
880 fprintf (dump_file
, "Transforming ");
881 print_generic_expr (dump_file
, rhs
, 0);
884 TREE_OPERAND (rhs
, 0) = oe1
->op
;
885 TREE_OPERAND (rhs
, 1) = oe2
->op
;
888 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
890 fprintf (dump_file
, " into ");
891 print_generic_stmt (dump_file
, rhs
, 0);
898 /* If we hit here, we should have 3 or more ops left. */
899 gcc_assert (opindex
+ 2 < VEC_length (operand_entry_t
, ops
));
901 /* Rewrite the next operator. */
902 oe
= VEC_index (operand_entry_t
, ops
, opindex
);
904 if (oe
->op
!= TREE_OPERAND (rhs
, 1))
907 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
909 fprintf (dump_file
, "Transforming ");
910 print_generic_expr (dump_file
, rhs
, 0);
913 TREE_OPERAND (rhs
, 1) = oe
->op
;
916 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
918 fprintf (dump_file
, " into ");
919 print_generic_stmt (dump_file
, rhs
, 0);
922 /* Recurse on the LHS of the binary operator, which is guaranteed to
923 be the non-leaf side. */
924 rewrite_expr_tree (SSA_NAME_DEF_STMT (TREE_OPERAND (rhs
, 0)),
928 /* Transform STMT, which is really (A +B) + (C + D) into the left
929 linear form, ((A+B)+C)+D.
930 Recurse on D if necessary. */
933 linearize_expr (tree stmt
)
935 block_stmt_iterator bsinow
, bsirhs
;
936 tree rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
937 enum tree_code rhscode
= TREE_CODE (rhs
);
938 tree binrhs
= SSA_NAME_DEF_STMT (TREE_OPERAND (rhs
, 1));
939 tree binlhs
= SSA_NAME_DEF_STMT (TREE_OPERAND (rhs
, 0));
940 tree newbinrhs
= NULL_TREE
;
941 struct loop
*loop
= loop_containing_stmt (stmt
);
943 gcc_assert (is_reassociable_op (binlhs
, TREE_CODE (rhs
), loop
)
944 && is_reassociable_op (binrhs
, TREE_CODE (rhs
), loop
));
946 bsinow
= bsi_for_stmt (stmt
);
947 bsirhs
= bsi_for_stmt (binrhs
);
948 bsi_move_before (&bsirhs
, &bsinow
);
950 TREE_OPERAND (rhs
, 1) = TREE_OPERAND (GIMPLE_STMT_OPERAND (binrhs
, 1), 0);
951 if (TREE_CODE (TREE_OPERAND (rhs
, 1)) == SSA_NAME
)
952 newbinrhs
= SSA_NAME_DEF_STMT (TREE_OPERAND (rhs
, 1));
953 TREE_OPERAND (GIMPLE_STMT_OPERAND (binrhs
, 1), 0)
954 = GIMPLE_STMT_OPERAND (binlhs
, 0);
955 TREE_OPERAND (rhs
, 0) = GIMPLE_STMT_OPERAND (binrhs
, 0);
957 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
959 fprintf (dump_file
, "Linearized: ");
960 print_generic_stmt (dump_file
, rhs
, 0);
963 reassociate_stats
.linearized
++;
964 update_stmt (binrhs
);
965 update_stmt (binlhs
);
967 TREE_VISITED (binrhs
) = 1;
968 TREE_VISITED (binlhs
) = 1;
969 TREE_VISITED (stmt
) = 1;
971 /* Tail recurse on the new rhs if it still needs reassociation. */
972 if (newbinrhs
&& is_reassociable_op (newbinrhs
, rhscode
, loop
))
973 linearize_expr (stmt
);
976 /* If LHS has a single immediate use that is a GIMPLE_MODIFY_STMT, return
977 it. Otherwise, return NULL. */
980 get_single_immediate_use (tree lhs
)
982 use_operand_p immuse
;
985 if (TREE_CODE (lhs
) == SSA_NAME
986 && single_imm_use (lhs
, &immuse
, &immusestmt
))
988 if (TREE_CODE (immusestmt
) == RETURN_EXPR
)
989 immusestmt
= TREE_OPERAND (immusestmt
, 0);
990 if (TREE_CODE (immusestmt
) == GIMPLE_MODIFY_STMT
)
995 static VEC(tree
, heap
) *broken_up_subtracts
;
998 /* Recursively negate the value of TONEGATE, and return the SSA_NAME
999 representing the negated value. Insertions of any necessary
1000 instructions go before BSI.
1001 This function is recursive in that, if you hand it "a_5" as the
1002 value to negate, and a_5 is defined by "a_5 = b_3 + b_4", it will
1003 transform b_3 + b_4 into a_5 = -b_3 + -b_4. */
1006 negate_value (tree tonegate
, block_stmt_iterator
*bsi
)
1008 tree negatedef
= tonegate
;
1009 tree resultofnegate
;
1011 if (TREE_CODE (tonegate
) == SSA_NAME
)
1012 negatedef
= SSA_NAME_DEF_STMT (tonegate
);
1014 /* If we are trying to negate a name, defined by an add, negate the
1015 add operands instead. */
1016 if (TREE_CODE (tonegate
) == SSA_NAME
1017 && TREE_CODE (negatedef
) == GIMPLE_MODIFY_STMT
1018 && TREE_CODE (GIMPLE_STMT_OPERAND (negatedef
, 0)) == SSA_NAME
1019 && has_single_use (GIMPLE_STMT_OPERAND (negatedef
, 0))
1020 && TREE_CODE (GIMPLE_STMT_OPERAND (negatedef
, 1)) == PLUS_EXPR
)
1022 block_stmt_iterator bsi
;
1023 tree binop
= GIMPLE_STMT_OPERAND (negatedef
, 1);
1025 bsi
= bsi_for_stmt (negatedef
);
1026 TREE_OPERAND (binop
, 0) = negate_value (TREE_OPERAND (binop
, 0),
1028 bsi
= bsi_for_stmt (negatedef
);
1029 TREE_OPERAND (binop
, 1) = negate_value (TREE_OPERAND (binop
, 1),
1031 update_stmt (negatedef
);
1032 return GIMPLE_STMT_OPERAND (negatedef
, 0);
1035 tonegate
= fold_build1 (NEGATE_EXPR
, TREE_TYPE (tonegate
), tonegate
);
1036 resultofnegate
= force_gimple_operand_bsi (bsi
, tonegate
, true,
1037 NULL_TREE
, true, BSI_SAME_STMT
);
1038 VEC_safe_push (tree
, heap
, broken_up_subtracts
, resultofnegate
);
1039 return resultofnegate
;
1043 /* Return true if we should break up the subtract in STMT into an add
1044 with negate. This is true when we the subtract operands are really
1045 adds, or the subtract itself is used in an add expression. In
1046 either case, breaking up the subtract into an add with negate
1047 exposes the adds to reassociation. */
1050 should_break_up_subtract (tree stmt
)
1053 tree lhs
= GIMPLE_STMT_OPERAND (stmt
, 0);
1054 tree rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
1055 tree binlhs
= TREE_OPERAND (rhs
, 0);
1056 tree binrhs
= TREE_OPERAND (rhs
, 1);
1058 struct loop
*loop
= loop_containing_stmt (stmt
);
1060 if (TREE_CODE (binlhs
) == SSA_NAME
1061 && is_reassociable_op (SSA_NAME_DEF_STMT (binlhs
), PLUS_EXPR
, loop
))
1064 if (TREE_CODE (binrhs
) == SSA_NAME
1065 && is_reassociable_op (SSA_NAME_DEF_STMT (binrhs
), PLUS_EXPR
, loop
))
1068 if (TREE_CODE (lhs
) == SSA_NAME
1069 && (immusestmt
= get_single_immediate_use (lhs
))
1070 && TREE_CODE (GIMPLE_STMT_OPERAND (immusestmt
, 1)) == PLUS_EXPR
)
1076 /* Transform STMT from A - B into A + -B. */
1079 break_up_subtract (tree stmt
, block_stmt_iterator
*bsi
)
1081 tree rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
1083 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1085 fprintf (dump_file
, "Breaking up subtract ");
1086 print_generic_stmt (dump_file
, stmt
, 0);
1089 TREE_SET_CODE (GIMPLE_STMT_OPERAND (stmt
, 1), PLUS_EXPR
);
1090 TREE_OPERAND (rhs
, 1) = negate_value (TREE_OPERAND (rhs
, 1), bsi
);
1095 /* Recursively linearize a binary expression that is the RHS of STMT.
1096 Place the operands of the expression tree in the vector named OPS. */
1099 linearize_expr_tree (VEC(operand_entry_t
, heap
) **ops
, tree stmt
)
1101 block_stmt_iterator bsinow
, bsilhs
;
1102 tree rhs
= GENERIC_TREE_OPERAND (stmt
, 1);
1103 tree binrhs
= TREE_OPERAND (rhs
, 1);
1104 tree binlhs
= TREE_OPERAND (rhs
, 0);
1105 tree binlhsdef
, binrhsdef
;
1106 bool binlhsisreassoc
= false;
1107 bool binrhsisreassoc
= false;
1108 enum tree_code rhscode
= TREE_CODE (rhs
);
1109 struct loop
*loop
= loop_containing_stmt (stmt
);
1111 TREE_VISITED (stmt
) = 1;
1113 if (TREE_CODE (binlhs
) == SSA_NAME
)
1115 binlhsdef
= SSA_NAME_DEF_STMT (binlhs
);
1116 binlhsisreassoc
= is_reassociable_op (binlhsdef
, rhscode
, loop
);
1119 if (TREE_CODE (binrhs
) == SSA_NAME
)
1121 binrhsdef
= SSA_NAME_DEF_STMT (binrhs
);
1122 binrhsisreassoc
= is_reassociable_op (binrhsdef
, rhscode
, loop
);
1125 /* If the LHS is not reassociable, but the RHS is, we need to swap
1126 them. If neither is reassociable, there is nothing we can do, so
1127 just put them in the ops vector. If the LHS is reassociable,
1128 linearize it. If both are reassociable, then linearize the RHS
1131 if (!binlhsisreassoc
)
1135 if (!binrhsisreassoc
)
1137 add_to_ops_vec (ops
, binrhs
);
1138 add_to_ops_vec (ops
, binlhs
);
1142 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1144 fprintf (dump_file
, "swapping operands of ");
1145 print_generic_expr (dump_file
, stmt
, 0);
1148 swap_tree_operands (stmt
, &TREE_OPERAND (rhs
, 0),
1149 &TREE_OPERAND (rhs
, 1));
1152 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1154 fprintf (dump_file
, " is now ");
1155 print_generic_stmt (dump_file
, stmt
, 0);
1158 /* We want to make it so the lhs is always the reassociative op,
1164 else if (binrhsisreassoc
)
1166 linearize_expr (stmt
);
1167 gcc_assert (rhs
== GIMPLE_STMT_OPERAND (stmt
, 1));
1168 binlhs
= TREE_OPERAND (rhs
, 0);
1169 binrhs
= TREE_OPERAND (rhs
, 1);
1172 gcc_assert (TREE_CODE (binrhs
) != SSA_NAME
1173 || !is_reassociable_op (SSA_NAME_DEF_STMT (binrhs
),
1175 bsinow
= bsi_for_stmt (stmt
);
1176 bsilhs
= bsi_for_stmt (SSA_NAME_DEF_STMT (binlhs
));
1177 bsi_move_before (&bsilhs
, &bsinow
);
1178 linearize_expr_tree (ops
, SSA_NAME_DEF_STMT (binlhs
));
1179 add_to_ops_vec (ops
, binrhs
);
1182 /* Repropagate the negates back into subtracts, since no other pass
1183 currently does it. */
1186 repropagate_negates (void)
1191 for (i
= 0; VEC_iterate (tree
, broken_up_subtracts
, i
, negate
); i
++)
1193 tree user
= get_single_immediate_use (negate
);
1195 /* The negate operand can be either operand of a PLUS_EXPR
1196 (it can be the LHS if the RHS is a constant for example).
1198 Force the negate operand to the RHS of the PLUS_EXPR, then
1199 transform the PLUS_EXPR into a MINUS_EXPR. */
1201 && TREE_CODE (user
) == GIMPLE_MODIFY_STMT
1202 && TREE_CODE (GIMPLE_STMT_OPERAND (user
, 1)) == PLUS_EXPR
)
1204 tree rhs
= GIMPLE_STMT_OPERAND (user
, 1);
1206 /* If the negated operand appears on the LHS of the
1207 PLUS_EXPR, exchange the operands of the PLUS_EXPR
1208 to force the negated operand to the RHS of the PLUS_EXPR. */
1209 if (TREE_OPERAND (GIMPLE_STMT_OPERAND (user
, 1), 0) == negate
)
1211 tree temp
= TREE_OPERAND (rhs
, 0);
1212 TREE_OPERAND (rhs
, 0) = TREE_OPERAND (rhs
, 1);
1213 TREE_OPERAND (rhs
, 1) = temp
;
1216 /* Now transform the PLUS_EXPR into a MINUS_EXPR and replace
1217 the RHS of the PLUS_EXPR with the operand of the NEGATE_EXPR. */
1218 if (TREE_OPERAND (GIMPLE_STMT_OPERAND (user
, 1), 1) == negate
)
1220 TREE_SET_CODE (rhs
, MINUS_EXPR
);
1221 TREE_OPERAND (rhs
, 1) = get_unary_op (negate
, NEGATE_EXPR
);
1228 /* Break up subtract operations in block BB.
1230 We do this top down because we don't know whether the subtract is
1231 part of a possible chain of reassociation except at the top.
1240 we want to break up k = t - q, but we won't until we've transformed q
1241 = b - r, which won't be broken up until we transform b = c - d. */
1244 break_up_subtract_bb (basic_block bb
)
1246 block_stmt_iterator bsi
;
1249 for (bsi
= bsi_start (bb
); !bsi_end_p (bsi
); bsi_next (&bsi
))
1251 tree stmt
= bsi_stmt (bsi
);
1253 if (TREE_CODE (stmt
) == GIMPLE_MODIFY_STMT
)
1255 tree lhs
= GIMPLE_STMT_OPERAND (stmt
, 0);
1256 tree rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
1258 TREE_VISITED (stmt
) = 0;
1259 /* If associative-math we can do reassociation for
1260 non-integral types. Or, we can do reassociation for
1261 non-saturating fixed-point types. */
1262 if ((!INTEGRAL_TYPE_P (TREE_TYPE (lhs
))
1263 || !INTEGRAL_TYPE_P (TREE_TYPE (rhs
)))
1264 && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs
))
1265 || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(lhs
))
1266 || !flag_associative_math
)
1267 && (!NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE (rhs
))
1268 || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(lhs
))))
1271 /* Check for a subtract used only in an addition. If this
1272 is the case, transform it into add of a negate for better
1273 reassociation. IE transform C = A-B into C = A + -B if C
1274 is only used in an addition. */
1275 if (TREE_CODE (rhs
) == MINUS_EXPR
)
1276 if (should_break_up_subtract (stmt
))
1277 break_up_subtract (stmt
, &bsi
);
1280 for (son
= first_dom_son (CDI_DOMINATORS
, bb
);
1282 son
= next_dom_son (CDI_DOMINATORS
, son
))
1283 break_up_subtract_bb (son
);
1286 /* Reassociate expressions in basic block BB and its post-dominator as
1290 reassociate_bb (basic_block bb
)
1292 block_stmt_iterator bsi
;
1295 for (bsi
= bsi_last (bb
); !bsi_end_p (bsi
); bsi_prev (&bsi
))
1297 tree stmt
= bsi_stmt (bsi
);
1299 if (TREE_CODE (stmt
) == GIMPLE_MODIFY_STMT
)
1301 tree lhs
= GIMPLE_STMT_OPERAND (stmt
, 0);
1302 tree rhs
= GIMPLE_STMT_OPERAND (stmt
, 1);
1304 /* If this was part of an already processed tree, we don't
1305 need to touch it again. */
1306 if (TREE_VISITED (stmt
))
1309 /* If associative-math we can do reassociation for
1310 non-integral types. Or, we can do reassociation for
1311 non-saturating fixed-point types. */
1312 if ((!INTEGRAL_TYPE_P (TREE_TYPE (lhs
))
1313 || !INTEGRAL_TYPE_P (TREE_TYPE (rhs
)))
1314 && (!SCALAR_FLOAT_TYPE_P (TREE_TYPE (rhs
))
1315 || !SCALAR_FLOAT_TYPE_P (TREE_TYPE(lhs
))
1316 || !flag_associative_math
)
1317 && (!NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE (rhs
))
1318 || !NON_SAT_FIXED_POINT_TYPE_P (TREE_TYPE(lhs
))))
1321 if (associative_tree_code (TREE_CODE (rhs
)))
1323 VEC(operand_entry_t
, heap
) *ops
= NULL
;
1325 /* There may be no immediate uses left by the time we
1326 get here because we may have eliminated them all. */
1327 if (TREE_CODE (lhs
) == SSA_NAME
&& has_zero_uses (lhs
))
1330 TREE_VISITED (stmt
) = 1;
1331 linearize_expr_tree (&ops
, stmt
);
1332 qsort (VEC_address (operand_entry_t
, ops
),
1333 VEC_length (operand_entry_t
, ops
),
1334 sizeof (operand_entry_t
),
1335 sort_by_operand_rank
);
1336 optimize_ops_list (TREE_CODE (rhs
), &ops
);
1338 if (VEC_length (operand_entry_t
, ops
) == 1)
1340 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1342 fprintf (dump_file
, "Transforming ");
1343 print_generic_expr (dump_file
, rhs
, 0);
1345 GIMPLE_STMT_OPERAND (stmt
, 1)
1346 = VEC_last (operand_entry_t
, ops
)->op
;
1349 if (dump_file
&& (dump_flags
& TDF_DETAILS
))
1351 fprintf (dump_file
, " into ");
1352 print_generic_stmt (dump_file
,
1353 GIMPLE_STMT_OPERAND (stmt
, 1), 0);
1358 rewrite_expr_tree (stmt
, 0, ops
);
1361 VEC_free (operand_entry_t
, heap
, ops
);
1365 for (son
= first_dom_son (CDI_POST_DOMINATORS
, bb
);
1367 son
= next_dom_son (CDI_POST_DOMINATORS
, son
))
1368 reassociate_bb (son
);
1371 void dump_ops_vector (FILE *file
, VEC (operand_entry_t
, heap
) *ops
);
1372 void debug_ops_vector (VEC (operand_entry_t
, heap
) *ops
);
1374 /* Dump the operand entry vector OPS to FILE. */
1377 dump_ops_vector (FILE *file
, VEC (operand_entry_t
, heap
) *ops
)
1382 for (i
= 0; VEC_iterate (operand_entry_t
, ops
, i
, oe
); i
++)
1384 fprintf (file
, "Op %d -> rank: %d, tree: ", i
, oe
->rank
);
1385 print_generic_stmt (file
, oe
->op
, 0);
1389 /* Dump the operand entry vector OPS to STDERR. */
1392 debug_ops_vector (VEC (operand_entry_t
, heap
) *ops
)
1394 dump_ops_vector (stderr
, ops
);
1400 break_up_subtract_bb (ENTRY_BLOCK_PTR
);
1401 reassociate_bb (EXIT_BLOCK_PTR
);
1404 /* Initialize the reassociation pass. */
1412 int *bbs
= XNEWVEC (int, last_basic_block
+ 1);
1414 /* Find the loops, so that we can prevent moving calculations in
1416 loop_optimizer_init (AVOID_CFG_MODIFICATIONS
);
1418 memset (&reassociate_stats
, 0, sizeof (reassociate_stats
));
1420 operand_entry_pool
= create_alloc_pool ("operand entry pool",
1421 sizeof (struct operand_entry
), 30);
1423 /* Reverse RPO (Reverse Post Order) will give us something where
1424 deeper loops come later. */
1425 pre_and_rev_post_order_compute (NULL
, bbs
, false);
1426 bb_rank
= XCNEWVEC (long, last_basic_block
+ 1);
1427 operand_rank
= pointer_map_create ();
1429 /* Give each argument a distinct rank. */
1430 for (param
= DECL_ARGUMENTS (current_function_decl
);
1432 param
= TREE_CHAIN (param
))
1434 if (gimple_default_def (cfun
, param
) != NULL
)
1436 tree def
= gimple_default_def (cfun
, param
);
1437 insert_operand_rank (def
, ++rank
);
1441 /* Give the chain decl a distinct rank. */
1442 if (cfun
->static_chain_decl
!= NULL
)
1444 tree def
= gimple_default_def (cfun
, cfun
->static_chain_decl
);
1446 insert_operand_rank (def
, ++rank
);
1449 /* Set up rank for each BB */
1450 for (i
= 0; i
< n_basic_blocks
- NUM_FIXED_BLOCKS
; i
++)
1451 bb_rank
[bbs
[i
]] = ++rank
<< 16;
1454 calculate_dominance_info (CDI_POST_DOMINATORS
);
1455 broken_up_subtracts
= NULL
;
1458 /* Cleanup after the reassociation pass, and print stats if
1464 if (dump_file
&& (dump_flags
& TDF_STATS
))
1466 fprintf (dump_file
, "Reassociation stats:\n");
1467 fprintf (dump_file
, "Linearized: %d\n",
1468 reassociate_stats
.linearized
);
1469 fprintf (dump_file
, "Constants eliminated: %d\n",
1470 reassociate_stats
.constants_eliminated
);
1471 fprintf (dump_file
, "Ops eliminated: %d\n",
1472 reassociate_stats
.ops_eliminated
);
1473 fprintf (dump_file
, "Statements rewritten: %d\n",
1474 reassociate_stats
.rewritten
);
1477 pointer_map_destroy (operand_rank
);
1478 free_alloc_pool (operand_entry_pool
);
1480 VEC_free (tree
, heap
, broken_up_subtracts
);
1481 free_dominance_info (CDI_POST_DOMINATORS
);
1482 loop_optimizer_finalize ();
1485 /* Gate and execute functions for Reassociation. */
1488 execute_reassoc (void)
1493 repropagate_negates ();
1500 gate_tree_ssa_reassoc (void)
1502 return flag_tree_reassoc
!= 0;
1505 struct tree_opt_pass pass_reassoc
=
1507 "reassoc", /* name */
1508 gate_tree_ssa_reassoc
, /* gate */
1509 execute_reassoc
, /* execute */
1512 0, /* static_pass_number */
1513 TV_TREE_REASSOC
, /* tv_id */
1514 PROP_cfg
| PROP_ssa
| PROP_alias
, /* properties_required */
1515 0, /* properties_provided */
1516 0, /* properties_destroyed */
1517 0, /* todo_flags_start */
1518 TODO_dump_func
| TODO_ggc_collect
| TODO_verify_ssa
, /* todo_flags_finish */