Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2217757/?format=api
{ "id": 2217757, "url": "http://patchwork.ozlabs.org/api/patches/2217757/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260330135906.548951-1-hjl.tools@gmail.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": "<20260330135906.548951-1-hjl.tools@gmail.com>", "list_archive_url": null, "date": "2026-03-30T13:59:06", "name": "x86: Call ix86_access_stack_p only for larger alignment", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e26a0eaf152342e9516cdccebcb7a392c78b0150", "submitter": { "id": 4387, "url": "http://patchwork.ozlabs.org/api/people/4387/?format=api", "name": "H.J. Lu", "email": "hjl.tools@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260330135906.548951-1-hjl.tools@gmail.com/mbox/", "series": [ { "id": 498034, "url": "http://patchwork.ozlabs.org/api/series/498034/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498034", "date": "2026-03-30T13:59:06", "name": "x86: Call ix86_access_stack_p only for larger alignment", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/498034/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2217757/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2217757/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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=OSZbRRDR;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::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=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=OSZbRRDR", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=74.125.82.42" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::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 4fktD06TGNz1y1q\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 31 Mar 2026 00:59:44 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id C52DF4BA23FD\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 30 Mar 2026 13:59:42 +0000 (GMT)", "from mail-dl1-f42.google.com (mail-dl1-f42.google.com\n [74.125.82.42])\n by sourceware.org (Postfix) with ESMTPS id 713714BA2E0A\n for <gcc-patches@gcc.gnu.org>; Mon, 30 Mar 2026 13:59:14 +0000 (GMT)", "by mail-dl1-f42.google.com with SMTP id\n a92af1059eb24-12732e6a123so3229126c88.1\n for <gcc-patches@gcc.gnu.org>; Mon, 30 Mar 2026 06:59:14 -0700 (PDT)", "from gnu-tgl-3.localdomain ([172.59.163.89])\n by smtp.gmail.com with ESMTPSA id\n a92af1059eb24-12ab97cb08csm11400006c88.3.2026.03.30.06.59.12\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 30 Mar 2026 06:59:12 -0700 (PDT)", "from gnu-tgl-3.localdomain (localhost [127.0.0.1])\n by gnu-tgl-3.localdomain (Postfix) with ESMTP id 9CA40C0126;\n Mon, 30 Mar 2026 06:59:11 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org C52DF4BA23FD", "OpenDKIM Filter v2.11.0 sourceware.org 713714BA2E0A" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 713714BA2E0A", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 713714BA2E0A", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774879154; cv=none;\n b=BlIkpV7O1DU/KM4kMyTysduHyq4VEesKksOlOkKzBibfqRy0tBedyepJFSfynIUqQfxO7IrlZmjZuV8NK/1y7Ye0f4G962F6aW4HoTzCfgBq9/ndePTjtPHwWGjMQcYmOVbZsHsC5ugX4ap0Cy4B56vqYDdSW8Oq4awuGymr5Ho=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774879154; c=relaxed/simple;\n bh=XLVYgpF1+yJFHPc1th7GEPUbYD431dMWwkSco7nJnak=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=oTJCkDA5xGistf6ItW6r6r+I6z1pkJUFf+MXsxhmP4ZqvOvNq3ywVUk1i7Tuwqv3huO4OyKbGS8TIu/Nuw+0qLzOV+43Q/j/T/gmpKs4HhQra3Qe9cAkshrfebkjwnRmljsiyv/jtWUIn1KJWsnnTHzPnfd1tA40A3eOZPB9fVU=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774879153; x=1775483953; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=cyo5UYnasr+CxVUSDpf5dvJujqSA+Tsa96Za+nO+m9w=;\n b=OSZbRRDRjPpJCJeQHkEH13ssLReTMkmyJ5UYtXlsr1JMsC6ETSIHoi/hiVthEUYJ4v\n N/ONRf2CfZyJ5w9kPHzUblC3ELhRHqI2NilMU5SFshYP2rgvsHpgua+rs8CO0gCXkt1o\n IpGXOVFnyBVrNuGf2DsXw5qXgHUtcJEvXD1fwGKaJZyrulCXIWPGCEskvE13WjVksTqx\n mGvAFoDJzUKoYgaOZP5A0ArVOpHHlbkvGiY27jAp3799O+BBGZTMGh6bMNdoBDHbkTnz\n w7rFg/45m3467+3yZttuFCqkf6jxBl7D2F/Oggaq1XhNTx96rHjAg1z1Pjgqlx8ST5Iz\n qELg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774879153; x=1775483953;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=cyo5UYnasr+CxVUSDpf5dvJujqSA+Tsa96Za+nO+m9w=;\n b=qPM4v0fhAOcxdFPp0TeYVfa/Q9jX5a11kGqeE0oMSb398bGCOmAB7Ru24Y+70BYdY6\n cQOMXd4pqAK8WZEvQLM/n9mntiS2iKAGyDdgRKxez92+LwDwqG3TKTbS4fpoU1Ur/9bK\n tbDRsLxHHD4MvepbySkPfwdzrtwWELC00kcoXrEy2KhjZGw2Wi6D2c1YiMbozqqpmOeb\n 6UMEcaK4ng6DewCnudcuwcASjPDD0nFIUfTpODJaJZ/u9FAG9MfznFEcuzvHioGLufwr\n u24YjrgjfkPAYgHSWAdswvoBtVwN63hx0A1r8EGY/6hN09e98/5J/3ycp1FcWzICuLce\n 0uIw==", "X-Gm-Message-State": "AOJu0YwOfa2bEiZakWYMwON0MKXps0nBYokHyCtiretaPVNSMRwKTpdi\n Ze0AsKa/fF4jDGuBBE7Kzk56AbiMdoDPa8YsGEBGZHpP6BvRonaDrCj1GU6Dkw==", "X-Gm-Gg": "ATEYQzyWzmcaWc8Y3ElWuML5GgI34Dvsoec9o9mQbBToboKgrLaHFoLntFE+T8nBUWz\n VEMXfJDTYlVrTl3KvjRGcbte+APm43cn3LEmnacEeH8Mh8Kq1nrlkfLdgijhPq/EMbK3MGDEGFe\n AYrxhVcDuu5oMNUK68Q/mXOhf+z9LUsVA1n3QPnc8JkVUxcF6xqRCPb/uArCqaYHA8fVOph34OU\n 2L+s4GkOJPgjVrBGJc98wIcbJ1BjK2rZAlnTGf+3Gg6OabxKOj5PeNqZPjQRG49vMHoAVBk8BL8\n +4QjBslaZheBCn0t65x4tX5G3Jq5ctrHUg1DFQBDoNetNABPxpK3uRkXECwEW8Fe3zqqQv8oNNQ\n 8Xi/wgNYyJg29LZ0RAQufq5nyd0kIjVmL07nR0yVXyiMu0RbQEsFIHC6yGcSg/e7TvBFKtPA5A/\n 7VaPs7F+M5CRpvOIcSDpSBFkOLWCzJd5TCTc9czMg=", "X-Received": "by 2002:a05:7022:670d:b0:128:bb45:35b2 with SMTP id\n a92af1059eb24-12ab28c7c9amr8582097c88.12.1774879153064;\n Mon, 30 Mar 2026 06:59:13 -0700 (PDT)", "From": "\"H.J. Lu\" <hjl.tools@gmail.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "hongtao.liu@intel.com,\n\tubizjak@gmail.com", "Subject": "[PATCH] x86: Call ix86_access_stack_p only for larger alignment", "Date": "Mon, 30 Mar 2026 06:59:06 -0700", "Message-ID": "<20260330135906.548951-1-hjl.tools@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": "ix86_access_stack_p can be quite expensive. Don't check symbolic constant\nload. Instead, call ix86_access_stack_p only if an INSN needs alignment\n> stack alignment. This reduces the compile time of PR target/124684 from\n185 seconds to 24 seconds. The compile time of PR target/124165 test is\nunchanged.\n\n\tPR target/124165\n\tPR target/124684\n\t* config/i386/i386.cc (ix86_symbolic_const_load_p_1): Renamed to\n\t...\n\t(ix86_need_alignment_p_1): This.\n\t(ix86_symbolic_const_load_p): Renamed to ...\n\t(ix86_need_alignment_p): This.\n\t(ix86_find_max_used_stack_alignment): Call ix86_access_stack_p\n\tonly if the INSN needs alignment > stack alignment.\n\nSigned-off-by: H.J. Lu <hjl.tools@gmail.com>\n---\n gcc/config/i386/i386.cc | 63 ++++++++++-------------------------------\n 1 file changed, 15 insertions(+), 48 deletions(-)", "diff": "diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc\nindex 3f7fe0bcf0c..588e7c9d81d 100644\n--- a/gcc/config/i386/i386.cc\n+++ b/gcc/config/i386/i386.cc\n@@ -8781,19 +8781,15 @@ ix86_access_stack_p (unsigned int regno, basic_block bb,\n return false;\n }\n \n-/* Helper function for ix86_symbolic_const_load_p. */\n+/* Return true if SET needs alignment > ALIGNMENT. */\n \n static bool\n-ix86_symbolic_const_load_p_1 (rtx set)\n+ix86_need_alignment_p_1 (rtx set, unsigned int alignment)\n {\n rtx dest = SET_DEST (set);\n \n- if (!REG_P (dest))\n- return false;\n-\n- /* Reject non-Pmode modes. */\n- if (GET_MODE (dest) != Pmode)\n- return false;\n+ if (MEM_P (dest))\n+ return GET_MODE_ALIGNMENT (GET_MODE (dest)) > alignment;\n \n const_rtx src = SET_SRC (set);\n \n@@ -8803,22 +8799,20 @@ ix86_symbolic_const_load_p_1 (rtx set)\n auto op = *iter;\n \n if (MEM_P (op))\n-\titer.skip_subrtxes ();\n- else if (SYMBOLIC_CONST (op))\n-\treturn true;\n+\treturn GET_MODE_ALIGNMENT (GET_MODE (op)) > alignment;\n }\n \n return false;\n }\n \n-/* Return true if INSN loads a symbolic constant into register REGNO. */\n+/* Return true if INSN needs alignment > ALIGNMENT. */\n \n static bool\n-ix86_symbolic_const_load_p (rtx_insn *insn, unsigned int regno)\n+ix86_need_alignment_p (rtx_insn *insn, unsigned int alignment)\n {\n rtx set = single_set (insn);\n if (set)\n- return ix86_symbolic_const_load_p_1 (set);\n+ return ix86_need_alignment_p_1 (set, alignment);\n \n rtx pat = PATTERN (insn);\n if (GET_CODE (pat) != PARALLEL)\n@@ -8828,15 +8822,9 @@ ix86_symbolic_const_load_p (rtx_insn *insn, unsigned int regno)\n {\n rtx exp = XVECEXP (pat, 0, i);\n \n- if (GET_CODE (exp) == SET)\n-\t{\n-\t rtx dest = SET_DEST (exp);\n-\t if (REG_P (dest)\n-\t && GET_MODE (dest) == Pmode\n-\t && REGNO (dest) == regno\n-\t && ix86_symbolic_const_load_p_1 (exp))\n-\t return true;\n-\t}\n+ if (GET_CODE (exp) == SET\n+\t && ix86_need_alignment_p_1 (exp, alignment))\n+\treturn true;\n }\n \n return false;\n@@ -8902,8 +8890,6 @@ ix86_find_max_used_stack_alignment (unsigned int &stack_alignment,\n bitmap_set_bit (worklist, HARD_FRAME_POINTER_REGNUM);\n }\n \n- HARD_REG_SET hard_stack_slot_access = stack_slot_access;\n-\n calculate_dominance_info (CDI_DOMINATORS);\n \n unsigned int regno;\n@@ -8925,25 +8911,6 @@ ix86_find_max_used_stack_alignment (unsigned int &stack_alignment,\n \n EXECUTE_IF_SET_IN_HARD_REG_SET (stack_slot_access, 0, regno, hrsi)\n {\n- /* Set to true if there is a symbolic constant load into REGNO. */\n- bool symbolic_const_load_p = false;\n-\n- if (!TEST_HARD_REG_BIT (hard_stack_slot_access, regno))\n-\tfor (df_ref def = DF_REG_DEF_CHAIN (regno);\n-\t def;\n-\t def = DF_REF_NEXT_REG (def))\n-\t if (!DF_REF_IS_ARTIFICIAL (def)\n-\t && !DF_REF_FLAGS_IS_SET (def, DF_REF_MAY_CLOBBER)\n-\t && !DF_REF_FLAGS_IS_SET (def, DF_REF_MUST_CLOBBER))\n-\t {\n-\t rtx_insn *insn = DF_REF_INSN (def);\n-\t if (ix86_symbolic_const_load_p (insn, regno))\n-\t\t{\n-\t\t symbolic_const_load_p = true;\n-\t\t break;\n-\t\t}\n-\t }\n-\n for (df_ref ref = DF_REG_USE_CHAIN (regno);\n \t ref != NULL;\n \t ref = DF_REF_NEXT_REG (ref))\n@@ -8956,10 +8923,10 @@ ix86_find_max_used_stack_alignment (unsigned int &stack_alignment,\n \t if (!NONJUMP_INSN_P (insn))\n \t continue;\n \n-\t /* If there is no symbolic constant load into the register,\n-\t don't call ix86_access_stack_p. */\n-\t if (!symbolic_const_load_p\n-\t || ix86_access_stack_p (regno, BLOCK_FOR_INSN (insn),\n+\t /* Call ix86_access_stack_p only if INSN needs alignment >\n+\t STACK_ALIGNMENT. */\n+\t if (ix86_need_alignment_p (insn, stack_alignment)\n+\t && ix86_access_stack_p (regno, BLOCK_FOR_INSN (insn),\n \t\t\t\t set_up_by_prologue, prologue_used,\n \t\t\t\t reg_dominate_bbs_known,\n \t\t\t\t reg_dominate_bbs))\n", "prefixes": [] }