Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194912/?format=api
{ "id": 2194912, "url": "http://patchwork.ozlabs.org/api/patches/2194912/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260210085103.13656-1-jchrist@linux.ibm.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260210085103.13656-1-jchrist@linux.ibm.com>", "list_archive_url": null, "date": "2026-02-10T08:51:03", "name": "tree-optimization/122297 - fix load/store bias handling", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "077c0968d2290e5ae2f17136bb7aec343cf931f7", "submitter": { "id": 86782, "url": "http://patchwork.ozlabs.org/api/people/86782/?format=api", "name": "Juergen Christ", "email": "jchrist@linux.ibm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260210085103.13656-1-jchrist@linux.ibm.com/mbox/", "series": [ { "id": 491623, "url": "http://patchwork.ozlabs.org/api/series/491623/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491623", "date": "2026-02-10T08:51:03", "name": "tree-optimization/122297 - fix load/store bias handling", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491623/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194912/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194912/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=jGUrtZnT;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=ibm.com header.i=@ibm.com header.a=rsa-sha256\n header.s=pp1 header.b=jGUrtZnT", "sourceware.org;\n dmarc=none (p=none dis=none) header.from=linux.ibm.com", "sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=148.163.156.1" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4f9Fft5wYlz1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 19:51:50 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id B469B4BB3BB0\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 08:51:48 +0000 (GMT)", "from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com\n [148.163.156.1])\n by sourceware.org (Postfix) with ESMTPS id 211784B9DB56\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 08:51:18 +0000 (GMT)", "from pps.filterd (m0353729.ppops.net [127.0.0.1])\n by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 619GGdGa362336; Tue, 10 Feb 2026 08:51:14 GMT", "from ppma22.wdc07v.mail.ibm.com\n (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92])\n by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4c696w3atc-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 10 Feb 2026 08:51:13 +0000 (GMT)", "from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1])\n by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id\n 61A46baM008397;\n Tue, 10 Feb 2026 08:51:12 GMT", "from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228])\n by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4c6g3y8ns3-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n Tue, 10 Feb 2026 08:51:12 +0000", "from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com\n [10.20.54.101])\n by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id\n 61A8pA1e30081564\n (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);\n Tue, 10 Feb 2026 08:51:10 GMT", "from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 4E49C2004F;\n Tue, 10 Feb 2026 08:51:10 +0000 (GMT)", "from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1])\n by IMSVA (Postfix) with ESMTP id 0AFCF20043;\n Tue, 10 Feb 2026 08:51:10 +0000 (GMT)", "from li-3a824ecc-34fe-11b2-a85c-eae455c7d911.ibm.com.com (unknown\n [9.111.5.185]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP;\n Tue, 10 Feb 2026 08:51:09 +0000 (GMT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org B469B4BB3BB0", "OpenDKIM Filter v2.11.0 sourceware.org 211784B9DB56" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 211784B9DB56", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 211784B9DB56", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770713478; cv=none;\n b=HwvGCjMP/gLwTEuj6t+XR9jGd8fHoHwCSJm7C+22rE1hlk+PggG5CUHKJxGrDvXvJEa32nfT58ovEv+AAcZknXwx0suRp87axLK5cNkkLkWL0jTovka/CtpqEmgyddRE+HDr04kCTGP8cIlIhI1CXkoyzevFZGjoNAtHioMZ8IM=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770713478; c=relaxed/simple;\n bh=UAdfrtgPum7eNLnMiovATRjyjNv8o2niPH6EV0wcNSU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ZYjxUngKyAImD65iq+JCmGz/Kf6XLA8b25+T7sj/BOTBAdIb+1sONo8TonJuO3Sq07j3aYbaiHk6BUOyLOc3K6vJpuzaTtEykimr6v/6N8f1PXOFtAEZrGEUcb/cDSMuijV4qm7R9wpTxDI+egELJc87B3FBVAIKBOXDU+O1FfI=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc\n :content-transfer-encoding:date:from:message-id:mime-version\n :subject:to; s=pp1; bh=P6vvk1oWXWX2H3us96JK9ZuWwqBXv19CkS9wSUv53\n 3s=; b=jGUrtZnTtTsFB9Cn9kJceLc0RNTuU8a8QslZkuVBNajNaqgZx9xNjaZaD\n n3mbFUTMIjkhcVx9adY+Yh8Br1J5oRze3LDNleRmSgOcYTg9WTSBa1u1ES/5fyIf\n kmvjagBRHympsL1mPg3OdvNLGUWuoe5wNhasNqNZ24V/9/zsCCkXd8G88UIi4+u+\n hHdvC7CD7VbUFfzA/RLB3bsO1iMRTyZQ9nSx8W1IOJYZPZfn9ZNOjzJExro8tlVB\n 06Oo9NPOWaRwjDeyD+jKmlLVKGE/DynSERGO/NZQANpUgt0B0QrKmkOEqBCn3/Ns\n njjMhJzH1LvStVDSMeGKYqPxP+1lQ==", "From": "Juergen Christ <jchrist@linux.ibm.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "rguenther@suse.de, tamar.christina@arm.com, ook@ucw.cz,\n rdapp.gcc@gmail.com", "Subject": "[PATCH] tree-optimization/122297 - fix load/store bias handling", "Date": "Tue, 10 Feb 2026 09:51:03 +0100", "Message-ID": "<20260210085103.13656-1-jchrist@linux.ibm.com>", "X-Mailer": "git-send-email 2.43.7", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-TM-AS-GCONF": "00", "X-Proofpoint-Reinject": "loops=2 maxloops=12", "X-Authority-Analysis": "v=2.4 cv=YeCwJgRf c=1 sm=1 tr=0 ts=698af182 cx=c_pps\n a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17\n a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=Mpw57Om8IfrbqaoTuvik:22\n a=GgsMoib0sEa3-_RKJdDe:22 a=VnNF1IyMAAAA:8 a=HpOgF6MYsyLlEjdjMokA:9", "X-Proofpoint-GUID": "lkmuQPLRoRVen7AzTWtIn-kj2uy3nqd5", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwMjEwMDA3MyBTYWx0ZWRfXx1wmgmDt/y2N\n B7Iv3acpq/rmAa2whTnHURYxyabgH0tKXpmRbOBLJgm5DRTYWhhxLkCGqUc/3bywMNuzh5eZ9Xs\n Ow8lTJalkfVTAzMqbM2ErFiNo5RirCI5w3CfoFf4GHNd9/gq8vuNaFjGuMKqOqjy6JIklII0UiE\n j0QufaxzIR5MVj6NVchIWLNH6KMNKwfvhK7FPKz/gCVPpcJMFm4zULc+SnBEVSmomeEsAmkUdH0\n PHWr+C5fbEQwjZKQjSdAWhbSXz7+Q5hCdFaULZHGcbY94gmrHIfoY+0ZqgZqdOyOvLnXqddx/xG\n WILW8pefvahGVDTvljP068yc10zHho5zZJNXHO/mLEdwh7KPkVmPciIhS+nD0eUyvjSEBq0+L7T\n hXg627v7Fiin9d0mzM/v5P7pzKDRORQI3eJeB49yKHWb2AljGa1rOBKjbq6mI6SEfsrV+r+rJy/\n 0CzBW7hdHMJ2DFHTYuw==", "X-Proofpoint-ORIG-GUID": "-y7iV7DwbjNBF6iufiFQSO_ONwQHx-h2", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-02-09_01,2026-02-09_04,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 phishscore=0\n priorityscore=1501 lowpriorityscore=0 clxscore=1011 impostorscore=0\n spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000\n definitions=main-2602100073", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "When load/store with length is used and only QImode versions are\navailable, vectorizable_live_operation produces wrong results for\nVEC_EXTRACT. Provide a flag to vect_get_loop_len to specify if\nbias-adjusted length should be used or not.\n\n\tPR tree-optimization/122297 \n\ngcc/ChangeLog:\n\n\t* tree-vect-loop.cc (vectorize_fold_left_reduction): Adjust.\n\t(vectorizable_induction): Adjust.\n\t(vectorizable_live_operation_1): Adjust.\n\t(vect_get_loop_len): Provide parameter to select bias-adjusted\n\tlength.\n\t(vect_gen_loop_len_mask): Adjust.\n\t(vect_update_ivs_after_vectorizer_for_early_breaks): Adjust.\n\t* tree-vect-stmts.cc (vect_get_strided_load_store_ops): Adjust.\n\t(vectorizable_call): Adjust.\n\t(vectorizable_operation): Adjust.\n\t(vectorizable_store): Adjust.\n\t(vectorizable_load): Adjust.\n\t(vectorizable_condition): Adjust.\n\t* tree-vectorizer.h (vect_get_loop_len): Add parameter.\n\ngcc/testsuite/ChangeLog:\n\n\t* gcc.dg/vect/nodump-extractlast-1.c: Fix typo.\n\t* gcc.dg/vect/nodump-extractlast-2.c: New test.\n\nBootstrapped and regtested on s390, x86, and ppc64le. Ok for trunk?\n\nSigned-off-by: Juergen Christ <jchrist@linux.ibm.com>\n---\n .../gcc.dg/vect/nodump-extractlast-1.c | 2 +-\n .../gcc.dg/vect/nodump-extractlast-2.c | 23 +++++++\n gcc/tree-vect-loop.cc | 62 +++++++++++++------\n gcc/tree-vect-stmts.cc | 24 +++----\n gcc/tree-vectorizer.h | 2 +-\n 5 files changed, 82 insertions(+), 31 deletions(-)\n create mode 100644 gcc/testsuite/gcc.dg/vect/nodump-extractlast-2.c", "diff": "diff --git a/gcc/testsuite/gcc.dg/vect/nodump-extractlast-1.c b/gcc/testsuite/gcc.dg/vect/nodump-extractlast-1.c\nindex 980ac3e42188..83d8a38f13e3 100644\n--- a/gcc/testsuite/gcc.dg/vect/nodump-extractlast-1.c\n+++ b/gcc/testsuite/gcc.dg/vect/nodump-extractlast-1.c\n@@ -1,4 +1,4 @@\n-/* Check for a bung in the treatment of LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS when\n+/* Check for a bug in the treatment of LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS when\n using VEC_EXTRACT. */\n /* { dg-require-effective-target vect_int } */\n \ndiff --git a/gcc/testsuite/gcc.dg/vect/nodump-extractlast-2.c b/gcc/testsuite/gcc.dg/vect/nodump-extractlast-2.c\nnew file mode 100644\nindex 000000000000..9697687c1084\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/vect/nodump-extractlast-2.c\n@@ -0,0 +1,23 @@\n+/* Check for a bug in the treatment of LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS when\n+ using VEC_EXTRACT. This variant uses .LEN_LOAD which might use QImode\n+ vectors during load, but SImode vectors for the extraction. */\n+int __attribute__ ((noinline, noclone))\n+test_int (int *x, int n, int value)\n+{\n+ int last;\n+ for (int j = 0; j < n; ++j)\n+ {\n+ last = x[j];\n+ x[j] = last * value;\n+ }\n+ return last;\n+}\n+\n+int\n+main ()\n+{\n+ int arr[] = {1,2,3,4,5,1};\n+ if (test_int (arr, sizeof (arr) / sizeof (arr[0]), 42) != 1)\n+ __builtin_abort();\n+ return 0;\n+}\ndiff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc\nindex 8e60a433596f..8e40f0ceb93b 100644\n--- a/gcc/tree-vect-loop.cc\n+++ b/gcc/tree-vect-loop.cc\n@@ -6503,8 +6503,11 @@ vectorize_fold_left_reduction (loop_vec_info loop_vinfo,\n \tmask = vec_opmask[i];\n if (LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo))\n \t{\n+\t /* ??? Why do we use LOAD_STORE_BIAS here when we do not do a load or\n+\t a store? Shouldn't we instead just ensure that LEN represents the\n+\t number of elements in the vector? */\n \t len = vect_get_loop_len (loop_vinfo, gsi, lens, vec_num, vectype_in,\n-\t\t\t\t i, 1);\n+\t\t\t\t i, 1, false);\n \t signed char biasval = LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);\n \t bias = build_int_cst (intQI_type_node, biasval);\n \t if (!is_cond_op)\n@@ -9885,7 +9888,7 @@ vectorizable_induction (loop_vec_info loop_vinfo,\n \t\t _21 = vect_vec_iv_.6_22 + vect_cst__22; */\n \t vec_loop_lens *lens = &LOOP_VINFO_LENS (loop_vinfo);\n \t tree len = vect_get_loop_len (loop_vinfo, NULL, lens, 1,\n-\t\t\t\t\t vectype, 0, 0);\n+\t\t\t\t\t vectype, 0, 0, false);\n \t if (SCALAR_FLOAT_TYPE_P (stept))\n \t\texpr = gimple_build (&stmts, FLOAT_EXPR, stept, len);\n \t else\n@@ -10032,7 +10035,7 @@ vectorizable_live_operation_1 (loop_vec_info loop_vinfo, basic_block exit_bb,\n {\n /* Emit:\n \n-\t SCALAR_RES = VEC_EXTRACT <VEC_LHS, LEN - (BIAS + 1)>\n+\t SCALAR_RES = VEC_EXTRACT <VEC_LHS, LEN - 1>\n \n \t where VEC_LHS is the vectorized live-out result, LEN is the length of\n \t the vector, BIAS is the load-store bias. The bias should not be used\n@@ -10043,21 +10046,14 @@ vectorizable_live_operation_1 (loop_vec_info loop_vinfo, basic_block exit_bb,\n gimple_stmt_iterator gsi = gsi_last (tem);\n tree len = vect_get_loop_len (loop_vinfo, &gsi,\n \t\t\t\t &LOOP_VINFO_LENS (loop_vinfo),\n-\t\t\t\t 1, vectype, 0, 1);\n+\t\t\t\t 1, vectype, 0, 1, false);\n gimple_seq_add_seq (&stmts, tem);\n \n- /* BIAS + 1. */\n- signed char biasval = LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);\n- tree bias_plus_one\n-\t= int_const_binop (PLUS_EXPR,\n-\t\t\t build_int_cst (TREE_TYPE (len), biasval),\n-\t\t\t build_one_cst (TREE_TYPE (len)));\n-\n- /* LAST_INDEX = LEN - (BIAS + 1). */\n+ /* LAST_INDEX = LEN - 1. */\n tree last_index = gimple_build (&stmts, MINUS_EXPR, TREE_TYPE (len),\n-\t\t\t\t len, bias_plus_one);\n+\t\t\t\t len, build_one_cst (TREE_TYPE (len)));\n \n- /* SCALAR_RES = VEC_EXTRACT <VEC_LHS, LEN - (BIAS + 1)>. */\n+ /* SCALAR_RES = VEC_EXTRACT <VEC_LHS, LEN - 1>. */\n tree scalar_res\n \t= gimple_build (&stmts, CFN_VEC_EXTRACT, TREE_TYPE (vectype),\n \t\t\tvec_lhs_phi, last_index);\n@@ -10678,7 +10674,7 @@ vect_record_loop_len (loop_vec_info loop_vinfo, vec_loop_lens *lens,\n tree\n vect_get_loop_len (loop_vec_info loop_vinfo, gimple_stmt_iterator *gsi,\n \t\t vec_loop_lens *lens, unsigned int nvectors, tree vectype,\n-\t\t unsigned int index, unsigned int factor)\n+\t\t unsigned int index, unsigned int factor, bool adjusted)\n {\n rgroup_controls *rgl = &(*lens)[nvectors - 1];\n bool use_bias_adjusted_len =\n@@ -10711,7 +10707,7 @@ vect_get_loop_len (loop_vec_info loop_vinfo, gimple_stmt_iterator *gsi,\n \t}\n }\n \n- if (use_bias_adjusted_len)\n+ if (use_bias_adjusted_len && adjusted)\n return rgl->bias_adjusted_ctrl;\n \n tree loop_len = rgl->controls[index];\n@@ -10734,6 +10730,36 @@ vect_get_loop_len (loop_vec_info loop_vinfo, gimple_stmt_iterator *gsi,\n \t gsi_insert_seq_before (gsi, seq, GSI_SAME_STMT);\n \t}\n }\n+ else if (factor && rgl->factor != factor)\n+ {\n+ /* The number of scalars per iteration, scalar occupied bytes and\n+\t the number of vectors are both compile-time constants. */\n+ unsigned int nscalars_per_iter\n+\t= exact_div (nvectors * TYPE_VECTOR_SUBPARTS (vectype),\n+\t\t LOOP_VINFO_VECT_FACTOR (loop_vinfo)).to_constant ();\n+ unsigned int rglvecsize = rgl->factor * rgl->max_nscalars_per_iter;\n+ unsigned int vecsize = nscalars_per_iter * factor;\n+ if (rglvecsize > vecsize)\n+\t{\n+\t unsigned int fac = rglvecsize / vecsize;\n+\t tree iv_type = LOOP_VINFO_RGROUP_IV_TYPE (loop_vinfo);\n+\t gimple_seq seq = NULL;\n+\t loop_len = gimple_build (&seq, EXACT_DIV_EXPR, iv_type, loop_len,\n+\t\t\t\t build_int_cst (iv_type, fac));\n+\t if (seq)\n+\t gsi_insert_seq_before (gsi, seq, GSI_SAME_STMT);\n+\t}\n+ else if (rglvecsize < vecsize)\n+\t{\n+\t unsigned int fac = vecsize / rglvecsize;\n+\t tree iv_type = LOOP_VINFO_RGROUP_IV_TYPE (loop_vinfo);\n+\t gimple_seq seq = NULL;\n+\t loop_len = gimple_build (&seq, MULT_EXPR, iv_type, loop_len,\n+\t\t\t\t build_int_cst (iv_type, fac));\n+\t if (seq)\n+\t gsi_insert_seq_before (gsi, seq, GSI_SAME_STMT);\n+\t}\n+ }\n return loop_len;\n }\n \n@@ -10751,7 +10777,7 @@ vect_gen_loop_len_mask (loop_vec_info loop_vinfo, gimple_stmt_iterator *gsi,\n tree all_one_mask = build_all_ones_cst (vectype);\n tree all_zero_mask = build_zero_cst (vectype);\n tree len = vect_get_loop_len (loop_vinfo, gsi, lens, nvectors, vectype, index,\n-\t\t\t\tfactor);\n+\t\t\t\tfactor, true);\n tree bias = build_int_cst (intQI_type_node,\n \t\t\t LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo));\n tree len_mask = make_temp_ssa_name (TREE_TYPE (stmt), NULL, \"vec_len_mask\");\n@@ -11022,7 +11048,7 @@ vect_update_ivs_after_vectorizer_for_early_breaks (loop_vec_info loop_vinfo)\n {\n vec_loop_lens *lens = &LOOP_VINFO_LENS (loop_vinfo);\n tree_vf = vect_get_loop_len (loop_vinfo, NULL, lens, 1,\n-\t\t\t\t NULL_TREE, 0, 0);\n+\t\t\t\t NULL_TREE, 0, 0, true);\n }\n \n tree iter_var;\ndiff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc\nindex ed2486451ca0..a97f7ec07c4f 100644\n--- a/gcc/tree-vect-stmts.cc\n+++ b/gcc/tree-vect-stmts.cc\n@@ -3182,7 +3182,7 @@ vect_get_strided_load_store_ops (stmt_vec_info stmt_info, slp_tree node,\n \t .MASK_LEN_SCATTER_STORE (vectp_a.9_7, ... );\n \t vectp_a.9_26 = vectp_a.9_7 + ivtmp_8; */\n tree loop_len\n-\t= vect_get_loop_len (loop_vinfo, gsi, loop_lens, 1, vectype, 0, 0);\n+\t= vect_get_loop_len (loop_vinfo, gsi, loop_lens, 1, vectype, 0, 0, true);\n tree tmp\n \t= fold_build2 (MULT_EXPR, sizetype,\n \t\t fold_convert (sizetype, unshare_expr (DR_STEP (dr))),\n@@ -3253,7 +3253,7 @@ vect_get_loop_variant_data_ptr_increment (\n addr = addr + .SELECT_VL (ARG..) * step;\n */\n tree loop_len\n- = vect_get_loop_len (loop_vinfo, gsi, loop_lens, 1, aggr_type, 0, 0);\n+ = vect_get_loop_len (loop_vinfo, gsi, loop_lens, 1, aggr_type, 0, 0, true);\n tree len_type = TREE_TYPE (loop_len);\n /* Since the outcome of .SELECT_VL is element size, we should adjust\n it into bytesize so that it can be used in address pointer variable\n@@ -3842,7 +3842,7 @@ vectorizable_call (vec_info *vinfo,\n \t\t {\n \t\t unsigned int vec_num = vec_oprnds0.length ();\n \t\t tree len = vect_get_loop_len (loop_vinfo, gsi, lens,\n-\t\t\t\t\t\t vec_num, vectype_out, i, 1);\n+\t\t\t\t\t\t vec_num, vectype_out, i, 1, true);\n \t\t signed char biasval\n \t\t\t= LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);\n \t\t tree bias = build_int_cst (intQI_type_node, biasval);\n@@ -7041,7 +7041,7 @@ vectorizable_operation (vec_info *vinfo,\n \t if (len_loop_p)\n \t {\n \t tree len = vect_get_loop_len (loop_vinfo, gsi, lens,\n-\t\t\t\t\t vec_num, vectype, i, 1);\n+\t\t\t\t\t vec_num, vectype, i, 1, true);\n \t signed char biasval\n \t\t= LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);\n \t tree bias = build_int_cst (intQI_type_node, biasval);\n@@ -8757,7 +8757,7 @@ vectorizable_store (vec_info *vinfo,\n \t {\n \t if (loop_lens)\n \t\tfinal_len = vect_get_loop_len (loop_vinfo, gsi, loop_lens,\n-\t\t\t\t\t ncopies, vectype, j, 1);\n+\t\t\t\t\t ncopies, vectype, j, 1, true);\n \t else\n \t\tfinal_len = size_int (TYPE_VECTOR_SUBPARTS (vectype));\n \t signed char biasval\n@@ -8950,7 +8950,7 @@ vectorizable_store (vec_info *vinfo,\n \t\t if (loop_lens)\n \t\t final_len = vect_get_loop_len (loop_vinfo, gsi,\n \t\t\t\t\t\t loop_lens, num_stmts,\n-\t\t\t\t\t\t vectype, j, 1);\n+\t\t\t\t\t\t vectype, j, 1, true);\n \t\t else\n \t\t final_len = size_int (TYPE_VECTOR_SUBPARTS (vectype));\n \n@@ -9334,7 +9334,7 @@ vectorizable_store (vec_info *vinfo,\n \t unsigned factor\n \t = (new_ovmode == vmode) ? 1 : GET_MODE_UNIT_SIZE (vmode);\n \t final_len = vect_get_loop_len (loop_vinfo, gsi, loop_lens,\n-\t\t\t\t\t vec_num, vectype, i, factor);\n+\t\t\t\t\t vec_num, vectype, i, factor, true);\n \t}\n else if (final_mask)\n \t{\n@@ -10697,7 +10697,7 @@ vectorizable_load (vec_info *vinfo,\n \t {\n \t if (loop_lens)\n \t\tfinal_len = vect_get_loop_len (loop_vinfo, gsi, loop_lens,\n-\t\t\t\t\t ncopies, vectype, j, 1);\n+\t\t\t\t\t ncopies, vectype, j, 1, true);\n \t else\n \t\tfinal_len = size_int (TYPE_VECTOR_SUBPARTS (vectype));\n \t signed char biasval\n@@ -10900,7 +10900,7 @@ vectorizable_load (vec_info *vinfo,\n \t\t{\n \t\t if (loop_lens)\n \t\t final_len = vect_get_loop_len (loop_vinfo, gsi, loop_lens,\n-\t\t\t\t\t\t vec_num, vectype, i, 1);\n+\t\t\t\t\t\t vec_num, vectype, i, 1, true);\n \t\t else\n \t\t final_len = build_int_cst (sizetype,\n \t\t\t\t\t TYPE_VECTOR_SUBPARTS (vectype));\n@@ -11352,7 +11352,7 @@ vectorizable_load (vec_info *vinfo,\n \t\tunsigned factor\n \t\t = (new_ovmode == vmode) ? 1 : GET_MODE_UNIT_SIZE (vmode);\n \t\tfinal_len = vect_get_loop_len (loop_vinfo, gsi, loop_lens,\n-\t\t\t\t\t vec_num, vectype, i, factor);\n+\t\t\t\t\t vec_num, vectype, i, factor, true);\n \t }\n \t else if (final_mask)\n \t {\n@@ -12429,8 +12429,10 @@ vectorizable_condition (vec_info *vinfo,\n \t {\n \t if (lens)\n \t\t{\n+\t\t /* ??? Do we really want the adjusted LEN here? Isn't this\n+\t\t based on number of elements? */\n \t\t len = vect_get_loop_len (loop_vinfo, gsi, lens,\n-\t\t\t\t\t vec_num, vectype, i, 1);\n+\t\t\t\t\t vec_num, vectype, i, 1, true);\n \t\t signed char biasval\n \t\t = LOOP_VINFO_PARTIAL_LOAD_STORE_BIAS (loop_vinfo);\n \t\t bias = build_int_cst (intQI_type_node, biasval);\ndiff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h\nindex 7a38d4969cf2..2116507b69ce 100644\n--- a/gcc/tree-vectorizer.h\n+++ b/gcc/tree-vectorizer.h\n@@ -2673,7 +2673,7 @@ extern void vect_record_loop_len (loop_vec_info, vec_loop_lens *, unsigned int,\n \t\t\t\t tree, unsigned int);\n extern tree vect_get_loop_len (loop_vec_info, gimple_stmt_iterator *,\n \t\t\t vec_loop_lens *, unsigned int, tree,\n-\t\t\t unsigned int, unsigned int);\n+\t\t\t unsigned int, unsigned int, bool);\n extern tree vect_gen_loop_len_mask (loop_vec_info, gimple_stmt_iterator *,\n \t\t\t\t gimple_stmt_iterator *, vec_loop_lens *,\n \t\t\t\t unsigned int, tree, tree, unsigned int,\n", "prefixes": [] }