This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I tried not to not duplicate the feedback you got from Richard.
+ /* In tree-ssa-loop-im.c */Fix comment indentation.
+ /* The possibilities of statement movement. */
+
+ enum move_pos
+ {
+ MOVE_IMPOSSIBLE, /* No movement -- side effect expression. */
+ MOVE_PRESERVE_EXECUTION, /* Must not cause the non-executed statement
+ become executed -- memory accesses, ... */
+ MOVE_POSSIBLE /* Unlimited movement. */
+ };
+ A short description of if-conversion: + + o Decide if loop is if-convertable or not.^ a
+ o Walk all loop basic blocks in breadth first ordr (BFS order).^^^^ order
+ o Remove conditional statements (at the end of basic block)
+ and propogate condition into destination basic blcoks'
+ predicate list.
+ o Replace modify expression with conditional modify expression
+ using current basic block's condition.
+ o Merge all basic blocks
+ o Replace phi nodes with conditional modify expr
+ o Merge all basic blocks into header
Please add a sample transformation here. Just to help the intuition of what we want to achieve.
+ /* Main entry point.Document argument FOR_VECTORIZER.
+ Apply if-conversion to the LOOP. Return true if successful otherwise return
+ false. If false is returned then loop remains unchanged. */
+
The return value doesn't seem to be used anywhere. Why is it important?
Similarly for most of the other comments. There are missing descriptions for arguments. Variables, arguments, etc should be capitalized inside comments. Also check for spelling and grammar.
No, we don't.+ /* CHECME: Do we need this? */ + compute_immediate_uses (TDFA_USE_OPS, NULL); + compute_immediate_uses (TDFA_USE_VOPS, NULL);
+ case COND_EXPR: + /* Update destination blocks' predicate list and remove this + condition expression. */ + tree_if_convert_cond_expr (loop, t, cond, bsi); + cond = NULL_TREE; /* CHECKME */
Why the CHECKME note? Haven't you already propagated the condition to the destination blocks?
+ static void + tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond, + block_stmt_iterator *bsi) + { + tree dst1, dst2, c, new_cond; + new_cond = NULL_TREE; + + #ifdef ENABLE_CHECKING + if (TREE_CODE (stmt) != COND_EXPR) + abort (); + #endif + + c = TREE_OPERAND (stmt, 0); + dst1 = TREE_OPERAND (stmt, 1); + dst2 = TREE_OPERAND (stmt, 2); +s/dst1/then_clause/ s/dst2/else_clause/
+ #if 0No #if 0 code, please.
+ /* If target does not support vector compare and select operations
+ then do not if-convert loop for vectorizer. */
+ if (for_vectorizer &&
+ (!targetm.vect.support_vector_compare_p ()
+ || !targetm.vect.support_vector_select_p ()))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "target does not support vector compare/select\n");
+ return false;
+ }
+ #endif
+
Why don't you just call fold() here?+ if (cond) + { + /* Attempt to do simple boolean expression simplification. */ +
Do we really want to always apply this transformation?+ static bool + gate_tree_if_conversion (void) + { + return true;
+ }Add PROP_alias.
+
+ struct tree_opt_pass pass_if_conversion =
+ {
+ "ifcvt", /* name */
+ gate_tree_if_conversion, /* gate */
+ test_if_conversion, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
Better move this to tree-if-conv.c.+ 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + TODO_dump_func + | TODO_verify_ssa + | TODO_verify_stmts | TODO_verify_flow /* todo_flags_finish */ + }; + /* Loop optimizer finalization. */
No. This goes in get_expr_operands.--- 615,620 ---- *************** build_ssa_operands (tree stmt, stmt_ann_ *** 833,839 **** switch (code) { case MODIFY_EXPR: ! get_expr_operands (stmt, &TREE_OPERAND (stmt, 1), opf_none); if (TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_REF || TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_RANGE_REF || TREE_CODE (TREE_OPERAND (stmt, 0)) == COMPONENT_REF --- 832,847 ---- switch (code) { case MODIFY_EXPR: ! if (TREE_CODE (TREE_OPERAND (stmt, 1)) == COND_EXPR) ! { ! tree t_stmt = TREE_OPERAND (stmt, 1); ! get_expr_operands (stmt, &COND_EXPR_COND (t_stmt), opf_none); ! get_expr_operands (stmt, &TREE_OPERAND (t_stmt, 1), opf_none); ! get_expr_operands (stmt, &TREE_OPERAND (t_stmt, 2), opf_none); ! } ! else ! get_expr_operands (stmt, &TREE_OPERAND (stmt, 1), opf_none); ! if (TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_REF || TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_RANGE_REF || TREE_CODE (TREE_OPERAND (stmt, 0)) == COMPONENT_REF
No. This must be handled by 'case COND_EXPR'.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |