get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2226306/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2226306,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2226306/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhubwh7m90.gcc.gcc-TEST.pinskia.33.1.2@forge-stage.sourceware.org/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/1.2/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": "<bmm.hhubwh7m90.gcc.gcc-TEST.pinskia.33.1.2@forge-stage.sourceware.org>",
    "list_archive_url": null,
    "date": "2026-04-22T10:49:11",
    "name": "[v1,02/15] phiopt: Reject hot/cold predictors for early phiopt [PR117935]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "9df2d01c67ddeddd91e9b2038deb03d84cdf0083",
    "submitter": {
        "id": 93219,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/93219/?format=api",
        "name": "Andrew Pinski via Sourceware Forge",
        "email": "forge-bot+pinskia@forge-stage.sourceware.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhubwh7m90.gcc.gcc-TEST.pinskia.33.1.2@forge-stage.sourceware.org/mbox/",
    "series": [
        {
            "id": 500990,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/500990/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500990",
            "date": "2026-04-22T10:49:12",
            "name": "copy-prop-arg",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500990/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2226306/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2226306/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 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; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org",
            "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39"
        ],
        "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 4g0xgs3T7Bz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 21:24:09 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 6D29A42ACFC4\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 11:24:07 +0000 (GMT)",
            "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 91C9741627D4\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:50:31 +0000 (GMT)",
            "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 6793E42BD7\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:50:31 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 6D29A42ACFC4",
            "OpenDKIM Filter v2.11.0 sourceware.org 91C9741627D4"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 91C9741627D4",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 91C9741627D4",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776855031; cv=none;\n b=kpmo3WBdveCiAcZVvPbmZYsA5jXnUGN44U6nc2F7QxNrUvzaoT6dX3ZE9TJoZRBZQmYVlhbF2q1DCQMGf7pT6yAuOm7RJouwxU7JjHorCOkRL4HlYfOUbm+Ynpg+VU50N3Iu8PGKSdgOmgSO8ojJ8BKKs46fFFUDUFKqYyJb8yM=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776855031; c=relaxed/simple;\n bh=/vVoovrUCUNBdyY0g1c+ooGsPkoPs8CJNCevLpafdsI=;\n h=From:Date:Subject:To:Message-ID;\n b=OWeQAuW6qnSZqPSFcYbvxYfjyMdX1U6qzraxpQMx8p2msmrmgev081pam+QW7JY2OHaC9wvlQSEgegNwjLQV7oGzXBYp7gGQD8bHmybODospssEzQC+nNEsj3zctPe12HGic0n1HnXOTpZrGIHOn1VQgd8sJGJCS9DVsjg9PoOk=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "From": "Andrew Pinski via Sourceware Forge\n <forge-bot+pinskia@forge-stage.sourceware.org>",
        "Date": "Wed, 22 Apr 2026 10:49:11 +0000",
        "Subject": "[PATCH v1 02/15] phiopt: Reject hot/cold predictors for early phiopt\n [PR117935]",
        "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>",
        "Message-ID": "\n <bmm.hhubwh7m90.gcc.gcc-TEST.pinskia.33.1.2@forge-stage.sourceware.org>",
        "X-Mailer": "batrachomyomachia",
        "X-Pull-Request-Organization": "gcc",
        "X-Pull-Request-Repository": "gcc-TEST",
        "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/33",
        "References": "\n <bmm.hhubwh7m90.gcc.gcc-TEST.pinskia.33.1.0@forge-stage.sourceware.org>",
        "In-Reply-To": "\n <bmm.hhubwh7m90.gcc.gcc-TEST.pinskia.33.1.0@forge-stage.sourceware.org>",
        "X-Patch-URL": "\n https://forge.sourceware.org/pinskia/gcc-TEST/commit/94e9a7d5886e90e9a3a6239cdaf075fc8d43d17e",
        "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>",
        "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>,\n pinskia@gcc.gnu.org",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "From: Andrew Pinski <quic_apinski@quicinc.com>\n\nIn this case, early phiopt would get rid of the user provided predicator\nfor hot/cold as it would remove the basic blocks. The easiest and best option is\nfor early phi-opt don't do phi-opt if the middle basic-block(s) have either\na hot or cold predict statement. Then after inlining, jump threading will most likely\nhappen and that will keep around the predictor.\n\nNote this only needs to be done for match_simplify_replacement and not the other\nphi-opt functions because currently only match_simplify_replacement is able to skip\nmiddle bb with predicator statements in it.\n\nOK? Bootstrapped and tested on x86_64-linux-gnu.\n\n\tPR tree-optimization/117935\n\ngcc/ChangeLog:\n\n\t* tree-ssa-phiopt.cc (contains_hot_cold_predict): New function.\n\t(match_simplify_replacement): Return early if early_p and one of\n\tthe middle bb(s) have a hot/cold predict statement.\n\ngcc/testsuite/ChangeLog:\n\n\t* gcc.dg/predict-24.c: New test.\n\nSigned-off-by: Andrew Pinski <quic_apinski@quicinc.com>\n---\n gcc/testsuite/gcc.dg/predict-24.c | 24 +++++++++++++++++++++\n gcc/tree-ssa-phiopt.cc            | 35 +++++++++++++++++++++++++++++++\n 2 files changed, 59 insertions(+)\n create mode 100644 gcc/testsuite/gcc.dg/predict-24.c",
    "diff": "diff --git a/gcc/testsuite/gcc.dg/predict-24.c b/gcc/testsuite/gcc.dg/predict-24.c\nnew file mode 100644\nindex 000000000000..b2c8a77c323f\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/predict-24.c\n@@ -0,0 +1,24 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O2 -fdump-tree-profile_estimate\" } */\n+/* PR tree-optimization/117935 */\n+\n+static inline bool has_value(bool b)\n+{\n+  if (b)\n+  {\n+    [[gnu::hot, gnu::unused]] label1:\n+    return true;\n+  }\n+  else\n+    return false;\n+}\n+/* The hot label should last until it gets inlined into value_or and jump_threaded.  */\n+int value_or(bool b, int def0, int def1)\n+{\n+  if (has_value(b))\n+    return def0;\n+  else\n+    return def1;\n+}\n+/* { dg-final { scan-tree-dump-times \"first match heuristics: 90.00%\" 2 \"profile_estimate\"} } */\n+/* { dg-final { scan-tree-dump-times \"hot label heuristics of edge \\[0-9\\]+->\\[0-9]+: 90.00%\" 2 \"profile_estimate\"} } */\ndiff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc\nindex f67f52d2d69a..fb918f8825dd 100644\n--- a/gcc/tree-ssa-phiopt.cc\n+++ b/gcc/tree-ssa-phiopt.cc\n@@ -56,6 +56,7 @@ along with GCC; see the file COPYING3.  If not see\n #include \"tree-ssa-dce.h\"\n #include \"calls.h\"\n #include \"tree-ssa-loop-niter.h\"\n+#include \"gimple-predict.h\"\n \n /* Return the singleton PHI in the SEQ of PHIs for edges E0 and E1. */\n \n@@ -916,6 +917,27 @@ auto_flow_sensitive::~auto_flow_sensitive ()\n     p.second.restore (p.first);\n }\n \n+/* Returns true if BB contains an user provided predictor\n+   (PRED_HOT_LABEL/PRED_COLD_LABEL).  */\n+\n+static bool\n+contains_hot_cold_predict (basic_block bb)\n+{\n+  gimple_stmt_iterator gsi;\n+  gsi = gsi_start_nondebug_after_labels_bb (bb);\n+  for (; !gsi_end_p (gsi); gsi_next_nondebug (&gsi))\n+    {\n+      gimple *s = gsi_stmt (gsi);\n+      if (gimple_code (s) != GIMPLE_PREDICT)\n+\tcontinue;\n+      auto predict = gimple_predict_predictor (s);\n+      if (predict == PRED_HOT_LABEL\n+\t  || predict == PRED_COLD_LABEL)\n+\treturn true;\n+    }\n+  return false;\n+}\n+\n /*  The function match_simplify_replacement does the main work of doing the\n     replacement using match and simplify.  Return true if the replacement is done.\n     Otherwise return false.\n@@ -953,6 +975,19 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,\n \t\t\t\t\t  stmt_to_move_alt))\n     return false;\n \n+  /* For early phiopt, we don't want to lose user generated predictors,\n+     that is if either middle bb contains either a hot or cold label predict,\n+     the phiopt should be skipped. */\n+  if (early_p)\n+    {\n+      if (contains_hot_cold_predict (middle_bb))\n+\treturn false;\n+      if (threeway_p\n+\t  && middle_bb != middle_bb_alt\n+\t  && contains_hot_cold_predict (middle_bb_alt))\n+\treturn false;\n+    }\n+\n   /* Do not make conditional undefs unconditional.  */\n   if ((TREE_CODE (arg0) == SSA_NAME\n        && ssa_name_maybe_undef_p (arg0))\n",
    "prefixes": [
        "v1",
        "02/15"
    ]
}