Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226759/?format=api
{ "id": 2226759, "url": "http://patchwork.ozlabs.org/api/patches/2226759/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhup4p5wp2.gcc.gcc-TEST.pinskia.84.1.6@forge-stage.sourceware.org/", "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": "<bmm.hhup4p5wp2.gcc.gcc-TEST.pinskia.84.1.6@forge-stage.sourceware.org>", "list_archive_url": null, "date": "2026-04-22T18:49:14", "name": "[v1,06/10] fab/forwprop: Move optimize_unreachable to forwprop [PR121762]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "db5bb1006bde2e6bfc42b5c5b818b0d3dbdd19e7", "submitter": { "id": 93219, "url": "http://patchwork.ozlabs.org/api/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.hhup4p5wp2.gcc.gcc-TEST.pinskia.84.1.6@forge-stage.sourceware.org/mbox/", "series": [ { "id": 501092, "url": "http://patchwork.ozlabs.org/api/series/501092/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501092", "date": "2026-04-22T18:49:11", "name": "remove_fab", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501092/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226759/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226759/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 4g18MV4gVsz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 05:25:42 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id CC0274078CB5\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 19:25:40 +0000 (GMT)", "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 6B51B407FF68\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:50:43 +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 C4FFD43595\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:50:41 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org CC0274078CB5", "OpenDKIM Filter v2.11.0 sourceware.org 6B51B407FF68" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 6B51B407FF68", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 6B51B407FF68", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776883843; cv=none;\n b=D1jk+tR/ZSNZaT4Upn5bfus432sboop1rLjjjT1Q0EPLqx1quB1vDkXgcZuXEfqajr3N54T08NTcxTLIxsdqGRssJvotVJI3y9EQXIISOS6afEnQ0gvyqKlHcsVsacdTubxqQPtAaw9WXMYQEJ391y2lb/NfUkVXuUkmXgaelu4=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776883843; c=relaxed/simple;\n bh=QRDOQG++k7Yfox7VhbR1xbb/m27dHiDRnziiNWw0UJ0=;\n h=From:Date:Subject:To:Message-ID;\n b=hkn2UkVR7OwjZGeTGFQwJiZ+J9DWBdviTtLZ0dPHL39ScdChhXMpXZsFXKX871tmlPczKoMRi8Yx6cx1zsA65oy0OX7N+jxciV3c0oiNoS53MQox66lcbB3welxJSXGVCQh1OD/qR+zLjxkjHVuKZHthAh6tbN9HDDMGLGzwZAE=", "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 18:49:14 +0000", "Subject": "[PATCH v1 06/10] fab/forwprop: Move optimize_unreachable to forwprop\n [PR121762]", "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>", "Message-ID": "\n <bmm.hhup4p5wp2.gcc.gcc-TEST.pinskia.84.1.6@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/84", "References": "\n <bmm.hhup4p5wp2.gcc.gcc-TEST.pinskia.84.1.0@forge-stage.sourceware.org>", "In-Reply-To": "\n <bmm.hhup4p5wp2.gcc.gcc-TEST.pinskia.84.1.0@forge-stage.sourceware.org>", "X-Patch-URL": "\n https://forge.sourceware.org/pinskia/gcc-TEST/commit/4e30ef2090bd784e78e9ca25f91cc02c6d0f1f15", "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 <andrew.pinski@oss.qualcomm.com>\n\nThis moves the optimize_unreachable to forwprop from fab.\nThere is a slightly optimization here in that the first\nstatement is checked and outside of the main fold loop. And if\nthe statement is __builtin_unreachable, then call optimize_unreachable.\n\nBootstrapped and tested on x86_64-linux-gnu.\n\n\tPR tree-optimization/121762\ngcc/ChangeLog:\n\n\t* tree-ssa-ccp.cc (optimize_unreachable): Move to tree-ssa-forwprop.cc\n\t(pass_fold_builtins::execute): Remove handling of __builtin_unreachable.\n\t* tree-ssa-forwprop.cc (optimize_unreachable): New function from\n\ttree-ssa-ccp.cc. Change argument to bb. Remove check on first statement\n\tbeing the __builtin_unreachable since it is handled already.\n\t(pass_forwprop::execute): Handle first statement as being __builtin_unreachable\n\tby calling optimize_unreachable.\n\nSigned-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>\n---\n gcc/tree-ssa-ccp.cc | 58 -------------------------------------\n gcc/tree-ssa-forwprop.cc | 62 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 62 insertions(+), 58 deletions(-)", "diff": "diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc\nindex 739d3be91293..b69a8b64a61b 100644\n--- a/gcc/tree-ssa-ccp.cc\n+++ b/gcc/tree-ssa-ccp.cc\n@@ -3202,58 +3202,6 @@ optimize_stdarg_builtin (gimple_stmt_iterator *gsi, gimple *call)\n }\n }\n \n-/* Attemp to make the block of __builtin_unreachable I unreachable by changing\n- the incoming jumps. Return true if at least one jump was changed. */\n-\n-static bool\n-optimize_unreachable (gimple_stmt_iterator i)\n-{\n- basic_block bb = gsi_bb (i);\n- gimple_stmt_iterator gsi;\n- gimple *stmt;\n- edge_iterator ei;\n- edge e;\n- bool ret;\n-\n- if (flag_sanitize & SANITIZE_UNREACHABLE)\n- return false;\n- gsi = gsi_start_nondebug_after_labels_bb (bb);\n- /* Only handle the case that __builtin_unreachable is the first\n- statement in the block. We rely on DCE to remove stmts\n- without side-effects before __builtin_unreachable. */\n- if (*gsi != *i)\n- return false;\n-\n- ret = false;\n- FOR_EACH_EDGE (e, ei, bb->preds)\n- {\n- gsi = gsi_last_bb (e->src);\n- if (gsi_end_p (gsi))\n-\tcontinue;\n-\n- stmt = gsi_stmt (gsi);\n- if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))\n-\t{\n-\t if (e->flags & EDGE_TRUE_VALUE)\n-\t gimple_cond_make_false (cond_stmt);\n-\t else if (e->flags & EDGE_FALSE_VALUE)\n-\t gimple_cond_make_true (cond_stmt);\n-\t else\n-\t gcc_unreachable ();\n-\t update_stmt (cond_stmt);\n-\t}\n- else\n-\t{\n-\t /* Todo: handle other cases. Note that unreachable switch case\n-\t statements have already been removed. */\n-\t continue;\n-\t}\n-\n- ret = true;\n- }\n-\n- return ret;\n-}\n \n /* Convert\n _1 = __atomic_fetch_or_* (ptr_6, 1, _3);\n@@ -4235,12 +4183,6 @@ pass_fold_builtins::execute (function *fun)\n \t tree result = NULL_TREE;\n \t switch (DECL_FUNCTION_CODE (callee))\n \t\t{\n-\n-\t\tcase BUILT_IN_UNREACHABLE:\n-\t\t if (optimize_unreachable (i))\n-\t\t cfg_changed = true;\n-\t\t break;\n-\n \t\tcase BUILT_IN_ATOMIC_ADD_FETCH_1:\n \t\tcase BUILT_IN_ATOMIC_ADD_FETCH_2:\n \t\tcase BUILT_IN_ATOMIC_ADD_FETCH_4:\ndiff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc\nindex 06ce34c6782c..c7ac96a28aa0 100644\n--- a/gcc/tree-ssa-forwprop.cc\n+++ b/gcc/tree-ssa-forwprop.cc\n@@ -4903,6 +4903,49 @@ public:\n bool m_full_walk = false;\n }; // class pass_forwprop\n \n+/* Attemp to make the BB block of __builtin_unreachable unreachable by changing\n+ the incoming jumps. Return true if at least one jump was changed. */\n+\n+static bool\n+optimize_unreachable (basic_block bb)\n+{\n+ gimple_stmt_iterator gsi;\n+ gimple *stmt;\n+ edge_iterator ei;\n+ edge e;\n+ bool ret;\n+\n+ ret = false;\n+ FOR_EACH_EDGE (e, ei, bb->preds)\n+ {\n+ gsi = gsi_last_bb (e->src);\n+ if (gsi_end_p (gsi))\n+\tcontinue;\n+\n+ stmt = gsi_stmt (gsi);\n+ if (gcond *cond_stmt = dyn_cast <gcond *> (stmt))\n+\t{\n+\t if (e->flags & EDGE_TRUE_VALUE)\n+\t gimple_cond_make_false (cond_stmt);\n+\t else if (e->flags & EDGE_FALSE_VALUE)\n+\t gimple_cond_make_true (cond_stmt);\n+\t else\n+\t gcc_unreachable ();\n+\t update_stmt (cond_stmt);\n+\t}\n+ else\n+\t{\n+\t /* Todo: handle other cases. Note that unreachable switch case\n+\t statements have already been removed. */\n+\t continue;\n+\t}\n+\n+ ret = true;\n+ }\n+\n+ return ret;\n+}\n+\n unsigned int\n pass_forwprop::execute (function *fun)\n {\n@@ -4949,6 +4992,25 @@ pass_forwprop::execute (function *fun)\n edge_iterator ei;\n edge e;\n \n+ if (last_p\n+\t && !(flag_sanitize & SANITIZE_UNREACHABLE))\n+\t{\n+\t gimple_stmt_iterator gsi;\n+\t gsi = gsi_start_nondebug_after_labels_bb (bb);\n+\t if (!gsi_end_p (gsi))\n+\t if (gcall *call = dyn_cast<gcall*>(*gsi))\n+\t {\n+\t\ttree callee = gimple_call_fndecl (call);\n+\t\tif (callee\n+\t\t && fndecl_built_in_p (callee, BUILT_IN_UNREACHABLE)\n+\t\t && optimize_unreachable (bb))\n+\t\t {\n+\t\t cfg_changed = true;\n+\t\t continue;\n+\t\t }\n+\t }\n+\t}\n+\n /* Skip processing not executable blocks. We could improve\n \t single_use tracking by at least unlinking uses from unreachable\n \t blocks but since blocks with uses are not processed in a\n", "prefixes": [ "v1", "06/10" ] }