• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for OS216


Commit MetaInfo

Revision8ca74c42ca51abb08f66d1c6f26fcf00d2b829fc (tree)
Zeit2017-12-05 22:40:08
AutorBin Cheng <amker@gcc....>
CommiterBin Cheng

Log Message

gimple-loop-interchange.cc (struct induction): Rename fields.

2017-12-05 Bin Cheng <bin.cheng@arm.com>

* gimple-loop-interchange.cc (struct induction): Rename fields.
(dump_induction, loop_cand::analyze_induction_var): Update uses.
(loop_cand::undo_simple_reduction): Ditto.
(tree_loop_interchange::map_inductions_to_loop): Ditto.
(tree_loop_interchange::can_interchange_loops): Delete.
(tree_loop_interchange::interchange): Inline can_interchange_loops.

From-SVN: r255419

Ändern Zusammenfassung

Diff

--- a/gcc/gimple-loop-interchange.cc
+++ b/gcc/gimple-loop-interchange.cc
@@ -98,10 +98,11 @@ typedef struct induction
9898 {
9999 /* IV itself. */
100100 tree var;
101- /* Initializer. */
102- tree init;
103- /* IV's base and step part of SCEV. */
104- tree base;
101+ /* IV's initializing value, which is the init arg of the IV PHI node. */
102+ tree init_val;
103+ /* IV's initializing expr, which is (the expanded result of) init_val. */
104+ tree init_expr;
105+ /* IV's step. */
105106 tree step;
106107 } *induction_p;
107108
@@ -159,7 +160,7 @@ dump_induction (struct loop *loop, induction_p iv)
159160 fprintf (dump_file, " Induction: ");
160161 print_generic_expr (dump_file, iv->var, TDF_SLIM);
161162 fprintf (dump_file, " = {");
162- print_generic_expr (dump_file, iv->base, TDF_SLIM);
163+ print_generic_expr (dump_file, iv->init_expr, TDF_SLIM);
163164 fprintf (dump_file, ", ");
164165 print_generic_expr (dump_file, iv->step, TDF_SLIM);
165166 fprintf (dump_file, "}_%d\n", loop->num);
@@ -700,8 +701,8 @@ loop_cand::analyze_induction_var (tree var, tree chrec)
700701 {
701702 struct induction *iv = XCNEW (struct induction);
702703 iv->var = var;
703- iv->init = init;
704- iv->base = chrec;
704+ iv->init_val = init;
705+ iv->init_expr = chrec;
705706 iv->step = build_int_cst (TREE_TYPE (chrec), 0);
706707 m_inductions.safe_push (iv);
707708 return true;
@@ -715,8 +716,8 @@ loop_cand::analyze_induction_var (tree var, tree chrec)
715716
716717 struct induction *iv = XCNEW (struct induction);
717718 iv->var = var;
718- iv->init = init;
719- iv->base = CHREC_LEFT (chrec);
719+ iv->init_val = init;
720+ iv->init_expr = CHREC_LEFT (chrec);
720721 iv->step = CHREC_RIGHT (chrec);
721722
722723 if (dump_file && (dump_flags & TDF_DETAILS))
@@ -894,14 +895,14 @@ loop_cand::undo_simple_reduction (reduction_p re, bitmap dce_seeds)
894895 /* Find all stmts on which expression "MEM_REF[idx]" depends. */
895896 find_deps_in_bb_for_stmt (&stmts, gimple_bb (re->consumer), re->consumer);
896897 /* Because we generate new stmt loading from the MEM_REF to TMP. */
897- tree tmp = copy_ssa_name (re->var);
898+ tree cond, tmp = copy_ssa_name (re->var);
898899 stmt = gimple_build_assign (tmp, re->init_ref);
899900 gimple_seq_add_stmt_without_update (&stmts, stmt);
900901
901902 /* Init new_var to MEM_REF or CONST depending on if it is the first
902903 iteration. */
903904 induction_p iv = m_inductions[0];
904- tree cond = fold_build2 (NE_EXPR, boolean_type_node, iv->var, iv->init);
905+ cond = fold_build2 (NE_EXPR, boolean_type_node, iv->var, iv->init_val);
905906 new_var = copy_ssa_name (re->var);
906907 stmt = gimple_build_assign (new_var, COND_EXPR, cond, tmp, re->init);
907908 gimple_seq_add_stmt_without_update (&stmts, stmt);
@@ -964,7 +965,6 @@ public:
964965 private:
965966 void update_data_info (unsigned, unsigned, vec<data_reference_p>, vec<ddr_p>);
966967 bool valid_data_dependences (unsigned, unsigned, vec<ddr_p>);
967- bool can_interchange_loops (loop_cand &, loop_cand &);
968968 void interchange_loops (loop_cand &, loop_cand &);
969969 void map_inductions_to_loop (loop_cand &, loop_cand &);
970970 void move_code_to_inner_loop (struct loop *, struct loop *, basic_block *);
@@ -1056,21 +1056,6 @@ tree_loop_interchange::valid_data_dependences (unsigned i_idx, unsigned o_idx,
10561056 return true;
10571057 }
10581058
1059-/* Return true if ILOOP and OLOOP can be interchanged in terms of code
1060- transformation. */
1061-
1062-bool
1063-tree_loop_interchange::can_interchange_loops (loop_cand &iloop,
1064- loop_cand &oloop)
1065-{
1066- return (iloop.analyze_carried_vars (NULL)
1067- && iloop.analyze_lcssa_phis ()
1068- && oloop.analyze_carried_vars (&iloop)
1069- && oloop.analyze_lcssa_phis ()
1070- && iloop.can_interchange_p (NULL)
1071- && oloop.can_interchange_p (&iloop));
1072-}
1073-
10741059 /* Interchange two loops specified by ILOOP and OLOOP. */
10751060
10761061 void
@@ -1193,7 +1178,8 @@ tree_loop_interchange::map_inductions_to_loop (loop_cand &src, loop_cand &tgt)
11931178 {
11941179 /* Map the IV by creating the same one in target loop. */
11951180 tree var_before, var_after;
1196- tree base = unshare_expr (iv->base), step = unshare_expr (iv->step);
1181+ tree base = unshare_expr (iv->init_expr);
1182+ tree step = unshare_expr (iv->step);
11971183 create_iv (base, step, SSA_NAME_VAR (iv->var),
11981184 tgt.m_loop, &incr_pos, false, &var_before, &var_after);
11991185 bitmap_set_bit (m_dce_seeds, SSA_NAME_VERSION (var_before));
@@ -1580,7 +1566,12 @@ tree_loop_interchange::interchange (vec<data_reference_p> datarefs,
15801566 loop_cand oloop (m_loop_nest[o_idx], m_loop_nest[o_idx]);
15811567
15821568 /* Check if we can do transformation for loop interchange. */
1583- if (!can_interchange_loops (iloop, oloop))
1569+ if (!iloop.analyze_carried_vars (NULL)
1570+ || !iloop.analyze_lcssa_phis ()
1571+ || !oloop.analyze_carried_vars (&iloop)
1572+ || !oloop.analyze_lcssa_phis ()
1573+ || !iloop.can_interchange_p (NULL)
1574+ || !oloop.can_interchange_p (&iloop))
15841575 break;
15851576
15861577 /* Check profitability for loop interchange. */