public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4488] gimple-fold: Refine gimple_fold_partial_load_store_mem_ref [PR107412] Date: Mon, 5 Dec 2022 05:28:10 +0000 (GMT) [thread overview] Message-ID: <20221205052810.A2A56385455A@sourceware.org> (raw) https://gcc.gnu.org/g:380d62c14c99d8df13b7a86660e7ee67d01ad827 commit r13-4488-g380d62c14c99d8df13b7a86660e7ee67d01ad827 Author: Kewen Lin <linkw@linux.ibm.com> Date: Sun Dec 4 23:27:08 2022 -0600 gimple-fold: Refine gimple_fold_partial_load_store_mem_ref [PR107412] Following Richard's review comments, this patch is to use untruncated type for the length used for IFN_LEN_{LOAD,STORE} instead of "unsigned int" for better robustness. It also avoid to use to_constant and tree arithmetic for subtraction. Co-authored-by: Richard Sandiford <richard.sandiford@arm.com> PR tree-optimization/107412 gcc/ChangeLog: * gimple-fold.cc (gimple_fold_partial_load_store_mem_ref): Use untruncated type for the length, and avoid to_constant and tree arithmetic for subtraction. Diff: --- gcc/gimple-fold.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/gcc/gimple-fold.cc b/gcc/gimple-fold.cc index c2d9c806aee..88d14c7adcc 100644 --- a/gcc/gimple-fold.cc +++ b/gcc/gimple-fold.cc @@ -5387,18 +5387,17 @@ gimple_fold_partial_load_store_mem_ref (gcall *call, tree vectype, bool mask_p) tree mask = gimple_call_arg (call, 2); if (!integer_all_onesp (mask)) return NULL_TREE; - } else { + } + else + { tree basic_len = gimple_call_arg (call, 2); - if (!tree_fits_uhwi_p (basic_len)) + if (!poly_int_tree_p (basic_len)) return NULL_TREE; unsigned int nargs = gimple_call_num_args (call); tree bias = gimple_call_arg (call, nargs - 1); - gcc_assert (tree_fits_shwi_p (bias)); - tree biased_len = int_const_binop (MINUS_EXPR, basic_len, bias); - unsigned int len = tree_to_uhwi (biased_len); - unsigned int vect_len - = GET_MODE_SIZE (TYPE_MODE (vectype)).to_constant (); - if (vect_len != len) + gcc_assert (TREE_CODE (bias) == INTEGER_CST); + if (maybe_ne (wi::to_poly_widest (basic_len) - wi::to_widest (bias), + GET_MODE_SIZE (TYPE_MODE (vectype)))) return NULL_TREE; }
reply other threads:[~2022-12-05 5:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221205052810.A2A56385455A@sourceware.org \ --to=linkw@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).