public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Ondrej Kubanek <kubaneko@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/kubaneko/heads/histogram)] Revert "tried fix create_iv and failed" Date: Thu, 16 Feb 2023 16:27:10 +0000 (GMT) [thread overview] Message-ID: <20230216162710.4EEE53857437@sourceware.org> (raw) https://gcc.gnu.org/g:e58f11f4e1b381b74e508d4d2d42fd66c4c28768 commit e58f11f4e1b381b74e508d4d2d42fd66c4c28768 Author: Ondrej Kubanek <kubanek0ondrej@gmail.com> Date: Sat Aug 20 22:19:09 2022 +0200 Revert "tried fix create_iv and failed" This reverts commit 082a5ebc956de41baf9d45ed609542ddd520df2d. Diff: --- gcc/tree-ssa-loop-manip.cc | 198 --------------------------------------------- gcc/tree-ssa-loop-manip.h | 4 - 2 files changed, 202 deletions(-) diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc index 2d76b7888f8..410a8516370 100644 --- a/gcc/tree-ssa-loop-manip.cc +++ b/gcc/tree-ssa-loop-manip.cc @@ -180,204 +180,6 @@ find_sibling_superloop (class loop *use_loop, class loop *def_loop) return use_loop; } -// create_iv2 simplified version of create iv nor requiring pre-headers -void -create_iv2 (tree base, tree step, tree var, class loop *loop, - gimple_stmt_iterator *incr_pos, bool after, - tree *var_before, tree *var_after) -{ - gassign *stmt; - gphi *phi; - tree initial, step1; - gimple_seq stmts; - tree vb, va; - enum tree_code incr_op = PLUS_EXPR; - - if (var != NULL_TREE) - { - vb = make_ssa_name (var); - va = make_ssa_name (var); - } - else - { - vb = make_temp_ssa_name (TREE_TYPE (base), NULL, "ivtmp"); - va = make_temp_ssa_name (TREE_TYPE (base), NULL, "ivtmp"); - } - if (var_before) - *var_before = vb; - if (var_after) - *var_after = va; - - /* For easier readability of the created code, produce MINUS_EXPRs - when suitable. */ - if (TREE_CODE (step) == INTEGER_CST) - { - if (TYPE_UNSIGNED (TREE_TYPE (step))) - { - step1 = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); - if (tree_int_cst_lt (step1, step)) - { - incr_op = MINUS_EXPR; - step = step1; - } - } - else - { - bool ovf; - - if (!tree_expr_nonnegative_warnv_p (step, &ovf) - && may_negate_without_overflow_p (step)) - { - incr_op = MINUS_EXPR; - step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); - } - } - } - if (POINTER_TYPE_P (TREE_TYPE (base))) - { - if (TREE_CODE (base) == ADDR_EXPR) - mark_addressable (TREE_OPERAND (base, 0)); - step = convert_to_ptrofftype (step); - if (incr_op == MINUS_EXPR) - step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); - incr_op = POINTER_PLUS_EXPR; - } - /* Gimplify the step if necessary. We put the computations in front of the - loop (i.e. the step should be loop invariant). */ - step = force_gimple_operand (step, &stmts, true, NULL_TREE); - - stmt = gimple_build_assign (va, incr_op, vb, step); - /* Prevent the increment from inheriting a bogus location if it is not put - immediately after a statement whose location is known. */ - if (after) - { - if (gsi_end_p (*incr_pos) - || (is_gimple_debug (gsi_stmt (*incr_pos)) - && gsi_bb (*incr_pos) - && gsi_end_p (gsi_last_nondebug_bb (gsi_bb (*incr_pos))))) - { - edge e = single_succ_edge (gsi_bb (*incr_pos)); - gimple_set_location (stmt, e->goto_locus); - } - gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT); - } - else - { - gimple_stmt_iterator gsi = *incr_pos; - if (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi))) - gsi_next_nondebug (&gsi); - if (!gsi_end_p (gsi)) - gimple_set_location (stmt, gimple_location (gsi_stmt (gsi))); - gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT); - } - - initial = force_gimple_operand (base, &stmts, true, var); - - phi = create_phi_node (vb, loop->header); - add_phi_arg (phi, va, loop_latch_edge (loop), UNKNOWN_LOCATION); -} - -void -create_iv3 (tree base, tree step, tree var, class loop *loop, - gimple_stmt_iterator *incr_pos, bool after, - tree *var_before, tree *var_after) -{ - gassign *stmt; - gphi *phi; - tree initial, step1; - gimple_seq stmts; - tree vb, va; - enum tree_code incr_op = PLUS_EXPR; - - if (var != NULL_TREE) - { - vb = make_ssa_name (var); - va = make_ssa_name (var); - } - else - { - vb = make_temp_ssa_name (TREE_TYPE (base), NULL, "ivtmp"); - va = make_temp_ssa_name (TREE_TYPE (base), NULL, "ivtmp"); - } - if (var_before) - *var_before = vb; - if (var_after) - *var_after = va; - - /* For easier readability of the created code, produce MINUS_EXPRs - when suitable. */ - if (TREE_CODE (step) == INTEGER_CST) - { - if (TYPE_UNSIGNED (TREE_TYPE (step))) - { - step1 = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); - if (tree_int_cst_lt (step1, step)) - { - incr_op = MINUS_EXPR; - step = step1; - } - } - else - { - bool ovf; - - if (!tree_expr_nonnegative_warnv_p (step, &ovf) - && may_negate_without_overflow_p (step)) - { - incr_op = MINUS_EXPR; - step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); - } - } - } - if (POINTER_TYPE_P (TREE_TYPE (base))) - { - if (TREE_CODE (base) == ADDR_EXPR) - mark_addressable (TREE_OPERAND (base, 0)); - step = convert_to_ptrofftype (step); - if (incr_op == MINUS_EXPR) - step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); - incr_op = POINTER_PLUS_EXPR; - } - /* Gimplify the step if necessary. We put the computations in front of the - loop (i.e. the step should be loop invariant). */ - step = force_gimple_operand (step, &stmts, true, NULL_TREE); - if (stmts) - gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts); - - stmt = gimple_build_assign (va, incr_op, vb, step); - /* Prevent the increment from inheriting a bogus location if it is not put - immediately after a statement whose location is known. */ - if (after) - { - if (gsi_end_p (*incr_pos) - || (is_gimple_debug (gsi_stmt (*incr_pos)) - && gsi_bb (*incr_pos) - && gsi_end_p (gsi_last_nondebug_bb (gsi_bb (*incr_pos))))) - { - edge e = single_succ_edge (gsi_bb (*incr_pos)); - gimple_set_location (stmt, e->goto_locus); - } - gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT); - } - else - { - gimple_stmt_iterator gsi = *incr_pos; - if (!gsi_end_p (gsi) && is_gimple_debug (gsi_stmt (gsi))) - gsi_next_nondebug (&gsi); - if (!gsi_end_p (gsi)) - gimple_set_location (stmt, gimple_location (gsi_stmt (gsi))); - gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT); - } - - initial = force_gimple_operand (base, &stmts, true, var); - if (stmts) - gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts); - - phi = create_phi_node (vb, loop->header); - add_phi_arg (phi, initial, loop_preheader_edge (loop), UNKNOWN_LOCATION); - add_phi_arg (phi, va, loop_latch_edge (loop), UNKNOWN_LOCATION); -} - /* DEF_BB is a basic block containing a DEF that needs rewriting into loop-closed SSA form. USE_BLOCKS is the set of basic blocks containing uses of DEF that "escape" from the loop containing DEF_BB (i.e. blocks in diff --git a/gcc/tree-ssa-loop-manip.h b/gcc/tree-ssa-loop-manip.h index 9ee3e617bf1..924cac0edff 100644 --- a/gcc/tree-ssa-loop-manip.h +++ b/gcc/tree-ssa-loop-manip.h @@ -24,10 +24,6 @@ typedef void (*transform_callback)(class loop *, void *); extern void create_iv (tree, tree, tree, class loop *, gimple_stmt_iterator *, bool, tree *, tree *); -extern void create_iv2 (tree, tree, tree, class loop *, gimple_stmt_iterator *, - bool, tree *, tree *); -extern void create_iv3 (tree, tree, tree, class loop *, gimple_stmt_iterator *, - bool, tree *, tree *); extern void rewrite_into_loop_closed_ssa (bitmap, unsigned); extern void verify_loop_closed_ssa (bool, class loop * = NULL);
next reply other threads:[~2023-02-16 16:27 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-16 16:27 Ondrej Kubanek [this message] 2023-02-23 23:21 Ondrej Kubanek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230216162710.4EEE53857437@sourceware.org \ --to=kubaneko@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).