{"id":2224159,"url":"http://patchwork.ozlabs.org/api/patches/2224159/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260417020830.4154676-1-andrew.pinski@oss.qualcomm.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","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":"<20260417020830.4154676-1-andrew.pinski@oss.qualcomm.com>","list_archive_url":null,"date":"2026-04-17T02:08:29","name":"[GCC17-PATCH,1/2] phiopt: Set cfgchanged if cselim-limited happened","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"308d21dc122aa81fdc79fc3a8c90ffd817d169ec","submitter":{"id":91428,"url":"http://patchwork.ozlabs.org/api/people/91428/?format=json","name":"Andrew Pinski","email":"andrew.pinski@oss.qualcomm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260417020830.4154676-1-andrew.pinski@oss.qualcomm.com/mbox/","series":[{"id":500220,"url":"http://patchwork.ozlabs.org/api/series/500220/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500220","date":"2026-04-17T02:08:29","name":"[GCC17-PATCH,1/2] phiopt: Set cfgchanged if cselim-limited happened","version":1,"mbox":"http://patchwork.ozlabs.org/series/500220/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224159/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224159/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=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=M7RWkgSg;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=Yp71zhFV;\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=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=M7RWkgSg;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=Yp71zhFV","sourceware.org; dmarc=none (p=none dis=none)\n header.from=oss.qualcomm.com","sourceware.org;\n spf=pass smtp.mailfrom=oss.qualcomm.com","server2.sourceware.org;\n arc=none smtp.remote-ip=205.220.180.131"],"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 4fxdbw5D7pz1yGt\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 12:09:14 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 98B8B4BAD141\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 02:09:10 +0000 (GMT)","from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com\n [205.220.180.131])\n by sourceware.org (Postfix) with ESMTPS id 74E1B4BA2E1F\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 02:08:36 +0000 (GMT)","from pps.filterd (m0279871.ppops.net [127.0.0.1])\n by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63H18Dtb667679\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 02:08:35 GMT","from mail-pj1-f71.google.com (mail-pj1-f71.google.com\n [209.85.216.71])\n by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dkaxcr4qc-1\n (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n for <gcc-patches@gcc.gnu.org>; Fri, 17 Apr 2026 02:08:35 +0000 (GMT)","by mail-pj1-f71.google.com with SMTP id\n 98e67ed59e1d1-3595485abbbso216985a91.2\n for <gcc-patches@gcc.gnu.org>; Thu, 16 Apr 2026 19:08:35 -0700 (PDT)","from xeond2.wrightpinski.org ([98.97.39.214])\n by smtp.gmail.com with ESMTPSA id\n 98e67ed59e1d1-361410a7b95sm314182a91.11.2026.04.16.19.08.32\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 16 Apr 2026 19:08:33 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 98B8B4BAD141","OpenDKIM Filter v2.11.0 sourceware.org 74E1B4BA2E1F"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 74E1B4BA2E1F","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 74E1B4BA2E1F","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776391716; cv=none;\n b=WHiqel9dCwlhh1MdROrpVVqLMMapZTgpf6aIpcOKHCqNHMbiTXzB6oT/IsjnYfT1TEWstQRdbk4d89oNBOU9cYOKDbr0t5yi8lrQudjJQW9vC1NRQ1CHs6w6REj3FoD+yOw6SNAHDXYNRqe65SrUWref7KoHatmREoVR+13LUJI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776391716; c=relaxed/simple;\n bh=FjjFp+S3xa+pRut6RUtBmOjvfG7yTzGpAjEq6qBfYOs=;\n h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID:\n MIME-Version;\n b=YElUhc6WgV7k8oHRzstffGscS46g23hCucU+iFnYHU6Yuk+28WCCaq4akmGkhNLyUPLgqCLRXu2nycRNGueLksL4hV7HDzgj/vdc1xjUHFFABEdGzY8odxvc+58hXSlStJDsnakUMYJ6VlWuD+nrT/i1h8llk0djphuJP/ESVus=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n cc:content-transfer-encoding:date:from:message-id:mime-version\n :subject:to; s=qcppdkim1; bh=t0lgWBPYgSrSmXiUlujU9Tv3Z421H0YRc9q\n ImcSvUPM=; b=M7RWkgSgwPdFSC8Qi88Y5DkUp6P/W0ZfHA7qNInsJ7Y9kLxNmlJ\n yTFPZNkBJkXAbr+vt1CoJl31r08RtqXAGExsI9zdIBxRqiIk2Zncwxd9ntFpWp33\n mtD6dmTt76zrLRmnERGFDgBLqPg6h9CN0an6UdwE/lturFqtHJCn7694RhmP352l\n hbWxlqv0Yjv37jRNr9BmnGp38ujKiCu2UHbSH5ZfSdPqBBLviU+1GGYdnm0IjsPO\n sLWvfksVR2n1bPkClmChoxKHcVs1+UY8tvrwpWJvVbAosQx7jTr9vuFb0sbwMIuK\n O9HLdhPj+DCZUhfszdkwryaDrrN2jlAgNAw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1776391714; x=1776996514; 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=t0lgWBPYgSrSmXiUlujU9Tv3Z421H0YRc9qImcSvUPM=;\n b=Yp71zhFVKDBc64nq5pkslofPctOUMK4g8nfcwX1dmuHMIw9h4CfY2IctodKEbl5ZoH\n A+qvkFL1L59qf3ZrTeR1kpQPMEVkEly1dfZzSAUp7lX+Hx7J1BVpxsbsbF7fHfEEQtbN\n sr736rZZJuZ2+QsM+EVz7IC8xgD3DfeI/1C3JLDyRjG+W0VjfnrjB6wZ33EysluZAFF+\n QVyP5+/iOnxnkDGBy4CRV+xxZUdy8W631g3mJYSUEZ6WX2skJKeEoFlcMp9dLMgp7X6i\n xpJprDG3acOaFR53ctAIQcG1vqxa50EpVdAyY9wvgDrnIg75pnvyL57BjSHdqWP0YG6A\n TjwQ=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776391714; x=1776996514;\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=t0lgWBPYgSrSmXiUlujU9Tv3Z421H0YRc9qImcSvUPM=;\n b=BwTMuW9F2ghoH9Hq0oL1TLiYf/G7y1jdGSlksqgqbDXwNBpovmTMhZtGVuktLnTNuF\n 2LAo3JnPLiGZPGnZIdYqPa9i7skQ7fUnjxzDgvPWU3pEvVqC5ZQJCOS0hhFP906mUHF/\n YdaP2uGwQB4DI5GYiJ7scBSbz9F6IoagjPe/i85PfKRx2VF+qu3AgfGDfKyQ08stbqWr\n oYI7ZrzOvN2nSAfCiGlPtSyheq69+3jzZqNDyNZcumAB2NTR+IMxMObgMOi0culcZF6R\n fi/zDnSpCalvdJvgvwa7WleBPV7qRwYRF2l7pn89RMp3XO3gNRJlnhqZgL9FL9Vu0aM5\n eXDg==","X-Gm-Message-State":"AOJu0Yy8vKEb2awMOo8aZ0dlznvULCrnkwVNpa8BRNhXjUwraqvIVZxP\n xSNlweY1p+EK5eZLsgWAAQV2IbfPMrY1myvOtojVibA+t97VfZC/rxXOX7Wz/BvFvIAyJWvYYmq\n LNoAvtajhhIwi79qvQb/yQRC08t74uV7Ve2XLpWxAxDMgTrnFZqfh+02C6iaIdmwwfm6N","X-Gm-Gg":"AeBDievPj+8xPoQpsj+/eGkMGrJxN2Upuvx3HvCpR+DRDw/KWaqTGmBAygiIkdw5Qt7\n U9VSKeUV5W2Pcqc2vIXXygzDKkcT2dXNM9tr+aK9sJT8z58BpZ/48oHhU64+BerG5rF6lw6EaGE\n DVdyCs6swcfq5+fbiStsacOQdjUMc6ZM8GKV7KzLoMITtagqVZMExTMMMTG8EHyRKXFeAETbQ/F\n QcSSWjoV9iE1/isa71mGE3ESXzgBRWnDmQncwEbuMoRofZzLeKEiUvDJAiSwyrYipPxbruX377Q\n 2sAtoHyyLCOEDg2+24cWsWDoPmGgfVkl2Gr6VuvJCiYV0oaS+nxz1B8+NCNsqxMQiB3QlkCjkMz\n GnQk8CCVImj7R4f8BVDo0BIMtlUIOupgyToBt8CHD6PGpw5etVTTDKLw62rM=","X-Received":["by 2002:a17:90b:6cd:b0:35d:ac4d:3cb6 with SMTP id\n 98e67ed59e1d1-361403b790dmr850874a91.5.1776391714216;\n Thu, 16 Apr 2026 19:08:34 -0700 (PDT)","by 2002:a17:90b:6cd:b0:35d:ac4d:3cb6 with SMTP id\n 98e67ed59e1d1-361403b790dmr850850a91.5.1776391713592;\n Thu, 16 Apr 2026 19:08:33 -0700 (PDT)"],"From":"Andrew Pinski <andrew.pinski@oss.qualcomm.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Andrew Pinski <andrew.pinski@oss.qualcomm.com>","Subject":"[GCC17-PATCH 1/2] phiopt: Set cfgchanged if cselim-limited happened","Date":"Thu, 16 Apr 2026 19:08:29 -0700","Message-ID":"<20260417020830.4154676-1-andrew.pinski@oss.qualcomm.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Authority-Analysis":"v=2.4 cv=JcqMa0KV c=1 sm=1 tr=0 ts=69e19623 cx=c_pps\n a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=V8mNeic1A8NdUVuT7JxKYQ==:17\n a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22\n a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8\n a=-K5LXLgR9n4a0V7_c4MA:9 a=uKXjsCUrEbL0IQVhDsJ9:22","X-Proofpoint-Spam-Details-Enc":"AW1haW4tMjYwNDE3MDAxOSBTYWx0ZWRfX4vHMslQjpLkG\n MFVcSHAKl3ebDliP47jf/8hrq0oaafUXATrO/Tgbol1m5IOr8NRTclLTUooOPhXDrQ8q/y/41Vw\n GdqRlHJogChUusM1/OQVo+H5baAerZvdHjm8x0HTpWr8Deau9tWIyR3vZK8W20Vr9kfWx708E/m\n PQje99/9HGGtOH8fEj5roc9tfz+r8iCzYt+fZbKOnv98WUfwqx6vbjycydveDYC6oW4U/19uSsq\n enaJkrINA2AwIVxvZO+FrmVDl78Gf1Ghcx/tp4h4Mpy+yKYJqSxCEWDF9uCuMj82w4my1sSWhyG\n sHhEXhez2BZeo7YXlpwwMymgJIrL/pCg96G6CEsdYBqptCCY1E2EPWMCOTtPfNE0UdM4Hl8+G98\n 5OobFKW/vCI4fXY+GrAqHNDR1rd3M6rzjahGwJH2YpvR3I7uRs2HcFaHE9KAbXO6rPl4lv5PHmf\n 7l7emAwAMNfP0iS9G+w==","X-Proofpoint-GUID":"0g2axLQSZqz-n4msgbQOLTNMk0r-DYiK","X-Proofpoint-ORIG-GUID":"0g2axLQSZqz-n4msgbQOLTNMk0r-DYiK","X-Proofpoint-Virus-Version":"vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-16_04,2026-04-16_03,2025-10-01_01","X-Proofpoint-Spam-Details":"rule=outbound_notspam policy=outbound score=0\n spamscore=0 adultscore=0 clxscore=1015 malwarescore=0 phishscore=0\n suspectscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0\n bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound\n adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000\n definitions=main-2604170019","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":"I noticed while improving cselim-limited that if\nnot creating a new phi, there are a few empty basic blocks.\nSo this sets cfgcleanup when cselim-limited does\nsomething in phiopt. cselim-5.c shows the case I\nwas looking into.\n\ngcc/ChangeLog:\n\n\t* tree-ssa-phiopt.cc (pass_phiopt::execute): Set cfgcleanup\n\tif cselim_limited returns true.\n\ngcc/testsuite/ChangeLog:\n\n\t* gcc.dg/tree-ssa/cselim-5.c: New test.\n\nSigned-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>\n---\n gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c | 16 ++++++++++++++++\n gcc/tree-ssa-phiopt.cc                   |  5 +++--\n 2 files changed, 19 insertions(+), 2 deletions(-)\n create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c","diff":"diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c b/gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c\nnew file mode 100644\nindex 00000000000..8d1335f174a\n--- /dev/null\n+++ b/gcc/testsuite/gcc.dg/tree-ssa/cselim-5.c\n@@ -0,0 +1,16 @@\n+/* { dg-do compile } */\n+/* { dg-options \"-O1 -fdump-tree-phiopt1\" } */\n+\n+int t;\n+void f(int a, int b, int c, int d)\n+{\n+  if (b)\n+   t = 0;\n+  else\n+   t = 0;\n+}\n+\n+/* We should sink/merge the stores and end up with a single BB.  */\n+\n+/* { dg-final { scan-tree-dump-times \"t = 0;\" 1 \"phiopt1\" } } */\n+/* { dg-final { scan-tree-dump-times \"<bb \" 1 \"phiopt1\" } } */\ndiff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc\nindex 0bf7e58b8f0..324559e6a7d 100644\n--- a/gcc/tree-ssa-phiopt.cc\n+++ b/gcc/tree-ssa-phiopt.cc\n@@ -4048,10 +4048,11 @@ pass_phiopt::execute (function *)\n \t    hoist_adjacent_loads (bb, bb1, bb2, bb3);\n \n \t  /* Try to see if there are only store in each side of the if\n-\t     and try to remove that; don't do this for -Og.  */\n+\t     and try to remove that; don't do this for -Og.\n+\t     With sinking the stores we might end up with empty blocks.  */\n \t  if (EDGE_COUNT (bb3->preds) == 2 && !optimize_debug)\n \t    while (cond_if_else_store_replacement_limited (bb1, bb2, bb3))\n-\t      ;\n+\t      cfgchanged = true;\n \t}\n \n       gimple_stmt_iterator gsi;\n","prefixes":["GCC17-PATCH","1/2"]}