From: Sylvain Noiry <snoiry@kalrayinc.com>
To: gcc-patches@gcc.gnu.org
Cc: Sylvain Noiry <snoiry@kalrayinc.com>
Subject: [PATCH v2 09/11] Native complex ops: remove useless special cases
Date: Tue, 12 Sep 2023 12:07:11 +0200 [thread overview]
Message-ID: <20230912100713.1074-10-snoiry@kalrayinc.com> (raw)
In-Reply-To: <20230912100713.1074-1-snoiry@kalrayinc.com>
Summary:
Remove two special cases which are now useless with the new complex
handling.
gcc/ChangeLog:
* tree-ssa-forwprop.cc (pass_forwprop::execute): Remove
two special cases
---
gcc/tree-ssa-forwprop.cc | 133 +--------------------------------------
1 file changed, 3 insertions(+), 130 deletions(-)
diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc
index 30e99f812f1..0c968f6ca32 100644
--- a/gcc/tree-ssa-forwprop.cc
+++ b/gcc/tree-ssa-forwprop.cc
@@ -3670,61 +3670,8 @@ pass_forwprop::execute (function *fun)
!= TARGET_MEM_REF)
&& !stmt_can_throw_internal (fun, stmt))
{
- /* Rewrite loads used only in real/imagpart extractions to
- component-wise loads. */
- use_operand_p use_p;
- imm_use_iterator iter;
- bool rewrite = true;
- FOR_EACH_IMM_USE_FAST (use_p, iter, lhs)
- {
- gimple *use_stmt = USE_STMT (use_p);
- if (is_gimple_debug (use_stmt))
- continue;
- if (!is_gimple_assign (use_stmt)
- || (gimple_assign_rhs_code (use_stmt) != REALPART_EXPR
- && gimple_assign_rhs_code (use_stmt) != IMAGPART_EXPR)
- || TREE_OPERAND (gimple_assign_rhs1 (use_stmt), 0) != lhs)
- {
- rewrite = false;
- break;
- }
- }
- if (rewrite)
- {
- gimple *use_stmt;
- FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
- {
- if (is_gimple_debug (use_stmt))
- {
- if (gimple_debug_bind_p (use_stmt))
- {
- gimple_debug_bind_reset_value (use_stmt);
- update_stmt (use_stmt);
- }
- continue;
- }
-
- tree new_rhs = build1 (gimple_assign_rhs_code (use_stmt),
- TREE_TYPE (TREE_TYPE (rhs)),
- unshare_expr (rhs));
- gimple *new_stmt
- = gimple_build_assign (gimple_assign_lhs (use_stmt),
- new_rhs);
-
- location_t loc = gimple_location (use_stmt);
- gimple_set_location (new_stmt, loc);
- gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
- unlink_stmt_vdef (use_stmt);
- gsi_remove (&gsi2, true);
-
- gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
- }
-
- release_defs (stmt);
- gsi_remove (&gsi, true);
- }
- else
- gsi_next (&gsi);
+ /* Special case removed due to better complex processing. */
+ gsi_next (&gsi);
}
else if (TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE
&& (TYPE_MODE (TREE_TYPE (lhs)) == BLKmode
@@ -3739,81 +3686,7 @@ pass_forwprop::execute (function *fun)
optimize_vector_load (&gsi);
else if (code == COMPLEX_EXPR)
- {
- /* Rewrite stores of a single-use complex build expression
- to component-wise stores. */
- use_operand_p use_p;
- gimple *use_stmt, *def1, *def2;
- tree rhs2;
- if (single_imm_use (lhs, &use_p, &use_stmt)
- && gimple_store_p (use_stmt)
- && !gimple_has_volatile_ops (use_stmt)
- && is_gimple_assign (use_stmt)
- && (TREE_CODE (gimple_assign_lhs (use_stmt))
- != TARGET_MEM_REF))
- {
- tree use_lhs = gimple_assign_lhs (use_stmt);
- if (auto_var_p (use_lhs))
- DECL_NOT_GIMPLE_REG_P (use_lhs) = 1;
- tree new_lhs = build1 (REALPART_EXPR,
- TREE_TYPE (TREE_TYPE (use_lhs)),
- unshare_expr (use_lhs));
- gimple *new_stmt = gimple_build_assign (new_lhs, rhs);
- location_t loc = gimple_location (use_stmt);
- gimple_set_location (new_stmt, loc);
- gimple_set_vuse (new_stmt, gimple_vuse (use_stmt));
- gimple_set_vdef (new_stmt, make_ssa_name (gimple_vop (fun)));
- SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt;
- gimple_set_vuse (use_stmt, gimple_vdef (new_stmt));
- gimple_stmt_iterator gsi2 = gsi_for_stmt (use_stmt);
- gsi_insert_before (&gsi2, new_stmt, GSI_SAME_STMT);
-
- new_lhs = build1 (IMAGPART_EXPR,
- TREE_TYPE (TREE_TYPE (use_lhs)),
- unshare_expr (use_lhs));
- gimple_assign_set_lhs (use_stmt, new_lhs);
- gimple_assign_set_rhs1 (use_stmt, gimple_assign_rhs2 (stmt));
- update_stmt (use_stmt);
-
- release_defs (stmt);
- gsi_remove (&gsi, true);
- }
- /* Rewrite a component-wise load of a complex to a complex
- load if the components are not used separately. */
- else if (TREE_CODE (rhs) == SSA_NAME
- && has_single_use (rhs)
- && ((rhs2 = gimple_assign_rhs2 (stmt)), true)
- && TREE_CODE (rhs2) == SSA_NAME
- && has_single_use (rhs2)
- && (def1 = SSA_NAME_DEF_STMT (rhs),
- gimple_assign_load_p (def1))
- && (def2 = SSA_NAME_DEF_STMT (rhs2),
- gimple_assign_load_p (def2))
- && (gimple_vuse (def1) == gimple_vuse (def2))
- && !gimple_has_volatile_ops (def1)
- && !gimple_has_volatile_ops (def2)
- && !stmt_can_throw_internal (fun, def1)
- && !stmt_can_throw_internal (fun, def2)
- && gimple_assign_rhs_code (def1) == REALPART_EXPR
- && gimple_assign_rhs_code (def2) == IMAGPART_EXPR
- && operand_equal_p (TREE_OPERAND (gimple_assign_rhs1
- (def1), 0),
- TREE_OPERAND (gimple_assign_rhs1
- (def2), 0)))
- {
- tree cl = TREE_OPERAND (gimple_assign_rhs1 (def1), 0);
- gimple_assign_set_rhs_from_tree (&gsi, unshare_expr (cl));
- gcc_assert (gsi_stmt (gsi) == stmt);
- gimple_set_vuse (stmt, gimple_vuse (def1));
- gimple_set_modified (stmt, true);
- gimple_stmt_iterator gsi2 = gsi_for_stmt (def1);
- gsi_remove (&gsi, false);
- gsi_insert_after (&gsi2, stmt, GSI_SAME_STMT);
- }
- else
- gsi_next (&gsi);
- gsi_next (&gsi);
- }
+ gsi_next (&gsi);
else if (code == CONSTRUCTOR
&& VECTOR_TYPE_P (TREE_TYPE (rhs))
&& TYPE_MODE (TREE_TYPE (rhs)) == BLKmode
--
2.17.1
next prev parent reply other threads:[~2023-09-12 10:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 9:02 [PATCH 0/9] Native complex operations Sylvain Noiry
2023-07-17 9:02 ` [PATCH 1/9] Native complex operations: Conditional lowering Sylvain Noiry
2023-07-17 9:02 ` [PATCH 2/9] Native complex operations: Move functions to hooks Sylvain Noiry
2023-07-17 9:02 ` [PATCH 3/9] Native complex operations: Add gen_rtx_complex hook Sylvain Noiry
2023-07-17 9:02 ` [PATCH 4/9] Native complex operations: Allow native complex regs and ops in rtl Sylvain Noiry
2023-07-17 9:02 ` [PATCH 5/9] Native complex operations: Add the conjugate op in optabs Sylvain Noiry
2023-07-17 9:02 ` [PATCH 6/9] Native complex operations: Update how complex rotations are handled Sylvain Noiry
2023-07-17 9:02 ` [PATCH 7/9] Native complex operations: Vectorization of native complex operations Sylvain Noiry
2023-07-17 9:02 ` [PATCH 8/9] Native complex operations: Add explicit vector of complex Sylvain Noiry
2023-07-17 9:02 ` [PATCH 9/9] Native complex operation: Experimental support in x86 backend Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 0/11] Native complex operations Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 01/11] Native complex ops : Conditional lowering Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 02/11] Native complex ops: Move functions to hooks Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 03/11] Native complex ops: Add gen_rtx_complex hook Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 04/11] Native complex ops: Allow native complex regs and ops in rtl Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 05/11] Native complex ops: Add the conjugate op in optabs Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 06/11] Native complex ops: Update how complex rotations are handled Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 07/11] Native complex ops: Vectorization of native complex operations Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 08/11] Native complex ops: Add explicit vector of complex Sylvain Noiry
2023-09-12 17:25 ` Joseph Myers
2023-09-13 6:48 ` Richard Biener
2023-09-12 10:07 ` Sylvain Noiry [this message]
2023-09-12 10:07 ` [PATCH v2 10/11] Native complex ops: Add a fast complex multiplication pattern Sylvain Noiry
2023-09-12 10:07 ` [PATCH v2 11/11] Native complex ops: Experimental support in x86 backend Sylvain Noiry
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=20230912100713.1074-10-snoiry@kalrayinc.com \
--to=snoiry@kalrayinc.com \
--cc=gcc-patches@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: link
Be 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).