From patchwork Wed Jun 3 02:06:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Pinski X-Patchwork-Id: 136348 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4FF574BA2E17 for ; Wed, 3 Jun 2026 02:15:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4FF574BA2E17 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=kxXijHk2; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=YMZlPyYM X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by sourceware.org (Postfix) with ESMTPS id 20DD74BA2E12 for ; Wed, 3 Jun 2026 02:15:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 20DD74BA2E12 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oss.qualcomm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 20DD74BA2E12 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780452901; cv=none; b=o+qTLzIEcdB08QNAvzUMXmmUKp5yV1fqPmDf8bJsLg+Ycc/BmoagmOsY0922Ihcylyp0+hKQIx0cWmlw5mTZvQb4E1AjPK19I4ZHJMezJUovYTEFGDU1L/2oTgX9pc+Vim/icSBpq2Ib5qpot6FV5wLTgcvcwm9aIeS0ZneKNrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780452901; c=relaxed/simple; bh=AsD7orHmR7jp2fXD+LNjbCim3a5lzUcreNRsibNKteo=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Dkd2WuD2GfCCFg9yktKk+YpzHGF4Q/Oi2jLDOteft1Rg932RlF7OPXa66iz+nSoBs4g1n0HRTAXjmP+KZXowg+Oizv6vMq35z4/VXvC+ISKtRfNmjwDJVRogZNlLTCUS5o/yVLiu6kJYBMGgFnEPQbfK/UY3uaFWFC5C1vU6keM= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=kxXijHk2; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=YMZlPyYM DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 20DD74BA2E12 Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 652HWTKx1937691 for ; Wed, 3 Jun 2026 02:15:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=qcppdkim1; bh=RRNS2HhQ7Ogw6aIMq2EkdlFdKzG5UxMwiYj 2Dwie4K0=; b=kxXijHk2U0nnJcrcua/AyCLGtM6z2ZdUo43yE1UDCg7nLbBGs4J iDPLmA2rkkXZdO1gkEemDModhtIe02I0jNEn87k1WlJZmE7BMn8hmkdGOK1io79n t8ur9X+LLSjcEQ0h2Ld9a3gF5FtgEgq+/HlxHcEoql1Qjd3OulJnxlqZp8vVHGI7 D45iUOSti2HPXWXzT7DwuGIK3FIY1ru5ALxaw/h5z3aXFThA1ekU4Jcmg0BQt9ly cjP2eWLgE3RVwafQxZ+t3rSawxlX0kwl6R6JgpaTz6r0Yw+qGS+jxDDjM7iFmeBq raqiDovlrYGY1L+PYRO7hShVS3vd43KPysg== Received: from mail-yx1-f72.google.com (mail-yx1-f72.google.com [74.125.224.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ehqubn411-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 03 Jun 2026 02:15:00 +0000 (GMT) Received: by mail-yx1-f72.google.com with SMTP id 956f58d0204a3-6603d2b1769so5836674d50.3 for ; Tue, 02 Jun 2026 19:15:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1780452900; x=1781057700; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=RRNS2HhQ7Ogw6aIMq2EkdlFdKzG5UxMwiYj2Dwie4K0=; b=YMZlPyYMjoqIhPIOLgUHgjKooF+I4UqofUFVeb9C58BnrigSlNrveHDqL+N5k6Qk6C M2Gg82ZB5hQfVdvCWxC/LO2NXHJ0XYkfzYYL8zfwl8XOGGqXPnuorbbKLc575roixjs9 eWgnokF+oiq1AwXrkl1wbOQxji3oJ4EhbNxZHZjYD6WGoiu40LACMCvDp1sM4wdL85l9 LvYGuX3gHC6wLUeQdAVThmCJgmmdr+PUp2AaiVr3Qhh8y8g1605+opkJCuZnuVBpe+3v VgValACaxfOvBk01LoT3yMo1lwt05MobbWt6tp33i9gdM3PMzK0qRmTWM1nEoqUoWsM7 1H+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780452900; x=1781057700; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RRNS2HhQ7Ogw6aIMq2EkdlFdKzG5UxMwiYj2Dwie4K0=; b=cCDx35qUwa+onUnE8zl95Y98n2gIjN8HFENRq9jl6hlWyuWC23soHl9XCZMnxeRS+x T/T9vASIJnM/FlMpNx7N39u7s6gInZSe5A8O62Aq2Y2Gi4cPEmN//8t2sXVCu4O8WiC0 FiCaSmZUZHxLYXKJR3U2s9KeqzWd5jbEI1dvzA4WMCdbPODN63RkLPOVXtT8eHe27NHP L7Fh+CPOQ1KRpbVkGdco4bEC3w3qhv/loC4TNRnzMoY1TDkAriJo+0/UpgXB97bA3qLu JeRoFHakJrb0igz4Z82QSQ0pR0m27WR3QUoyoxNPq6Wf9JGgt1vu5kQ/Q4RjvTrJTBR4 at4g== X-Gm-Message-State: AOJu0YwNdFVWIT2KE9YvZK6JbGtHCQWJukF8IQgjPQFHySR4iaH1mSS/ ATYngWO5Cr6xNheTz+ScRghDdbPBsmf0LD5OMRQ5cAyrVd+NK1BQt8aalYYYr8OvqxdJpxuEzHH ozx+iAxMljindShKjq+9T/fC6nFPnaIT8GiFUgrEh8XjhSnPVi6v4BjSan/rQZvKuRxEm X-Gm-Gg: Acq92OHWbghOAWID4klkUI5ExsIsq1CGwtwjaXlW7yi5OivlzPHxAtJLA//dKe2uIoF bbdnKFLtSQLm32uWdFVR7id+9moA16FNQL/Is+qAiNYgOKw+jgLC+Z5zpISOoiC1G20ZvLbUxWH l3k4Z2hqgEH/u3XIKomIbUBPOAh1Y2fBlNg2IWGL4svoY21eyhZvdKkTF+JtmxsC5sJRz219X7t uAbMlvXhpqeqfMTH7LpmIXI3wWlNvIM1aDgcgA5QskFP8QAOXMQEQst7yiI6vLxKcn6O7UMBjgC Rs4/TlGCHLZ+pbFhTq0/YrVZgFtL0KMAAc11Dxx5cIdridyipGmqtyesInX6MiCxjsMHhUkP51Q zRzU+p/NuTmZauntupB+QN/aeoNBy/DjnRMx3LbrpWU0sP2SR2cMUAzUkx6U= X-Received: by 2002:a05:690e:1c21:b0:660:8fc2:cba0 with SMTP id 956f58d0204a3-660dc5e235cmr1286885d50.58.1780452899778; Tue, 02 Jun 2026 19:14:59 -0700 (PDT) X-Received: by 2002:a17:90b:5610:b0:36d:9e0b:3801 with SMTP id 98e67ed59e1d1-36e30d1c00fmr1272561a91.8.1780452398997; Tue, 02 Jun 2026 19:06:38 -0700 (PDT) Received: from xeond2.wrightpinski.org ([98.97.35.182]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36dd91820f3sm4348921a91.2.2026.06.02.19.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 19:06:38 -0700 (PDT) From: Andrew Pinski To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski Subject: [PATCH 1/2] sccopy: Handle ssa info for copies in sccopy Date: Tue, 2 Jun 2026 19:06:34 -0700 Message-ID: <20260603020635.2641527-1-andrew.pinski@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: rb-kp33NxxUYJEUeRzBFir3BQjtd8P-c X-Proofpoint-GUID: rb-kp33NxxUYJEUeRzBFir3BQjtd8P-c X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjAzMDAxOCBTYWx0ZWRfX2PLbMZ44aDUF J83PQqTmNSjSewSSVNusqinBxylf3ode67BCjJi1Jl7bTXIcSnu7e3NkHg4iHGn6KB5pw0ki1Ik 0BcCNeSZk1vJaGvoK68KhkWShemAVPjjoXZATzDby7w5hKGNMnyM7Z64ScM1T1zW0aToZlwpjV7 R0kceddDVKHoEsMtZC3ne3uy07NTqL8iz/PwNJSXcE7/L5jHh6/suYXGt6f51sDytu1OpAnxLrH KqzDbknvfqbuqKMunftPApOpSz34ENR4j8HCj+voAt6jEYIi88JE2QbrvrGGZqjT1K1Xx+cCBxI 5TVOFNCgIiX3DCYEBvgH0sEJLcDvvQQuwMwRPs/4lPdlhEjY/pxaOScdF+Aefk95EWGrkwm4mJN B5bIucObhm+///QTpW5VHovS5Tz626nUN76BRdZMQNvcEC1jD2xRjdz9nUlcnxTfDEtaIoXkHsX bDHZN+WAW5vlHGZl8wQ== X-Authority-Analysis: v=2.4 cv=FcoHAp+6 c=1 sm=1 tr=0 ts=6a1f8e24 cx=c_pps a=VEzVgl358Dq0xwHDEbsOzA==:117 a=jpuWWtznm249gNHsVapybA==:17 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=Wc_iDw3CuJZqM237zecA:9 a=uujmmnXaIg8lM0-o0HFK:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-03_01,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 bulkscore=0 impostorscore=0 malwarescore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606030018 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_LOW, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org Currently if the ssa info (range or aliasing) is different between the src and dest of a copy, sccopy will reject it. This fixes the FIXME and handles it in a similar way as copyprop handles it. This is needed to able to move sccopy earlier (before phiopt1) and to act like a copyprop pass. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: * gimple-ssa-sccopy.cc (stmt_may_generate_copy): Remove restriction on the ssa info being different for the "copy". (scc_copy_prop::replace_scc_by_value): Call maybe_duplicate_ssa_info_at_copy when copyproping a ssa name. Signed-off-by: Andrew Pinski --- gcc/gimple-ssa-sccopy.cc | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/gcc/gimple-ssa-sccopy.cc b/gcc/gimple-ssa-sccopy.cc index 0badfb11b93..4252e5295df 100644 --- a/gcc/gimple-ssa-sccopy.cc +++ b/gcc/gimple-ssa-sccopy.cc @@ -405,22 +405,6 @@ stmt_may_generate_copy (gimple *stmt) if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs)) return false; - /* It is possible that lhs has more alignment or value range information. By - propagating we would lose this information. So in the case that alignment - or value range information differs, we are conservative and do not - propagate. - - FIXME: Propagate alignment and value range info the same way copy-prop - does. */ - if (POINTER_TYPE_P (TREE_TYPE (lhs)) - && POINTER_TYPE_P (TREE_TYPE (rhs)) - && SSA_NAME_PTR_INFO (lhs) != SSA_NAME_PTR_INFO (rhs)) - return false; - if (!POINTER_TYPE_P (TREE_TYPE (lhs)) - && !POINTER_TYPE_P (TREE_TYPE (rhs)) - && SSA_NAME_RANGE_INFO (lhs) != SSA_NAME_RANGE_INFO (rhs)) - return false; - return true; /* A statement of type _2 = _1;. */ } @@ -497,6 +481,8 @@ scc_copy_prop::replace_scc_by_value (vec scc, tree val) } replace_uses_by (name, val); + if (TREE_CODE (val) == SSA_NAME) + maybe_duplicate_ssa_info_at_copy (name, val); bitmap_set_bit (dead_stmts, SSA_NAME_VERSION (name)); didsomething = true; } From patchwork Wed Jun 3 02:06:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Pinski X-Patchwork-Id: 136346 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A94194BA2E12 for ; Wed, 3 Jun 2026 02:07:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A94194BA2E12 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=Z0Uw+9lU; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=JHMA8gMA X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 1A2894BA2E12 for ; Wed, 3 Jun 2026 02:06:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1A2894BA2E12 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oss.qualcomm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1A2894BA2E12 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780452410; cv=none; b=GrFIsPyscAD9GODbCRgRRGpHikSyEsQvI4QHfKmCiGijzzAQrnxLVH+/4qIzexEvNwgfulRT92/gxG7gTEk3ZRUbhm9DXoqwg5N8totsN5sW3A2dU++6cNZxPkfgP+FQ+yO1hv99s2f6BOaaAgyyl2MEHKk+mvtDverXFfGrnNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780452410; c=relaxed/simple; bh=4toWirIlPhip7vp5ogfk7PIh6iTJ+pEhMLvbTrrDhQk=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=l8tJqSajYOutanzfP2P2iQxrV0Gr1BWYu1W+j9X7xqb1yHrsE1FblfQd+JcaSGRlHpYP7Pdp/sReUrUxRkBFDeNI2wk/dY/EQJlHePrkiprPcHNkr+Tl0fXTcdceCgp/m0IUEpeTmt8qqWPPYR2+xu4HLAxqMuab2I0dZZxvEtU= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=Z0Uw+9lU; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=JHMA8gMA DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A2894BA2E12 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65318JUC2359260 for ; Wed, 3 Jun 2026 02:06:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=EpbefLU0VsR aZITMZnUl32XLd5MfFll9lwKoudsmv8Q=; b=Z0Uw+9lUAOJAjRhW3a78pfkH0Sb pGfFqzmzzpWDwZLMqDs2EbSgewNcmvqc64CqIu5ixKUtDqSnYZFEfHQ4Sgix1Nrv YEoKfERBqcyfYZlHm/Qc35PNxIk17R1IUap9D6Dg7xG4g+DaRcc7rxXJfPvmhZvR ERNm/it/Q01Kp1Er3Rt0VjoGQ+U1amhBhaYf0FwCpb2paoSJODw8yf8h5vGPawWE M396ATjn4Eevz+87L9TD9poh6cAlzlng7yKb7J0DLeQ0tO8Xb8RHoRkmJulmTQzM 44ZC1uUfPzlprkaioklCvs9gh9jhPl3txo71oFXyjzrmSAbRxXGEwINBSNg== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ejabg05u6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 03 Jun 2026 02:06:48 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-36bb6c41341so6356516a91.3 for ; Tue, 02 Jun 2026 19:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1780452408; x=1781057208; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EpbefLU0VsRaZITMZnUl32XLd5MfFll9lwKoudsmv8Q=; b=JHMA8gMASn3Jtuwd5afmgCelS5rddf3RzOS3k8yhDS5NFS4d5zuSLGuCQvVvcRB6im zkOFj4iPQB/v4MChhbcS6Rcs9gYG/+Ta+UJNlpC2uRdSaFSFFC0qe4/y1mDNMtgMJC9Y YDwADH+Fnwkjp8J+KH+J/nr7ixRp8A+M+gbd4aDb4Tfsy7xnfKjj37EbbO05D9IHRo21 sfvIVqgy9h561oVCD5UnOMJDT/YzT8q++xmntCh17m0tc2sBMOzYKGJoc2MbF/Hyj/0o pd5xdGnVaKv0a4JJhM19oHs1gC6Nr/24AXQlHvyYPZXsFSsja0WyvIDy+C0cMAZxU9wM v+TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780452408; x=1781057208; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=EpbefLU0VsRaZITMZnUl32XLd5MfFll9lwKoudsmv8Q=; b=ak4aKr/4vUrtUaj/G8Sbvl+9Ge7d0SDQWQ0zA1c9chUVkfhW1eMAZvabQE1oF7LyWZ rZTxIJooMQ6TE4BBOJcECJGMloo3pK8J3BYW/aitKVblU29zwk5A8jKLun5zzYM/183X /K0uZ8kzU6r/T95xQNL0HTPz2yeItl+Td4hQH6puNQVjh8XrHmrGVCTbNka1EZRR+nEe dg0EEcuISbhUFbymTf5T62DiT7o1whQ5eJvQ8aiuD9IVz12ILwg6heYSdmaAQsgS4D3L pc++yfRJaenfjIJA40oi9bObZMm9cdM+SyO2A28co6T3bCIopUuiImfk+tbwGATDwOGw Cw/w== X-Gm-Message-State: AOJu0YxOkqsuVqt574LggQSj/whCOPlaCaOp9OxlfQmMm8w63uNeKQSC aiqjho/ZG18HWT/rQL5GFbCCSPJ4N6BAeAO2vRV0vOZHYsq1UAfBAxPzoJRUoaIkCorkMj2+1xa mgwFMoIc0ykXbo6t+gQwFSIziGLWMj6JRyrz6mnCdW7ffd7zLC7FUaNpTo1jxn5u2Pwpr X-Gm-Gg: Acq92OEvqD6f/k8pdM4UlraT7QzOorP92PlwvnywsLShy8vemjD7PjmLOMFGAylvZzp VlPv+gq+6yyCbCa19cU5YbP/m9EiYFjQzNf2RnS5EL0bbIUP5Hz9TedsurGxlkgl2kDHmOAinfS 7LgbzP6/OgQ4o2FqBq93kmIPabuTNEEcI+uy6xztEwCkqVokjer1JkNxgVJruYJL6T46RURU+2C hfTd5n6rpyd/A+LJUSLnoSNMM5ZpFlUssMxwMVxOdbYdAtY1hKYrl+WEwujXzCafgg/Fe3NVQBy iXKWWR7fpNrq9vx0ilmJdveQUC2KW4E4TP2aUflxD7K4Q+ggXamqklKtlldsiGsEFVposDwZsYy UgMEfdNc2uCiRdxRfirV2TmQreiX8Fxu1AU8Spg9g/L/RiPRgjdBovwFa/Ow= X-Received: by 2002:a17:90a:c887:b0:36b:293:68d1 with SMTP id 98e67ed59e1d1-36e30a29736mr1166813a91.16.1780452407822; Tue, 02 Jun 2026 19:06:47 -0700 (PDT) X-Received: by 2002:a17:90a:c887:b0:36b:293:68d1 with SMTP id 98e67ed59e1d1-36e30a29736mr1166793a91.16.1780452407328; Tue, 02 Jun 2026 19:06:47 -0700 (PDT) Received: from xeond2.wrightpinski.org ([98.97.35.182]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36dd91820f3sm4348921a91.2.2026.06.02.19.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 19:06:46 -0700 (PDT) From: Andrew Pinski To: gcc-patches@gcc.gnu.org Cc: Andrew Pinski Subject: [PATCH 2/2] passes: Move early pass_sccopy right after evrp [PR103221] Date: Tue, 2 Jun 2026 19:06:35 -0700 Message-ID: <20260603020635.2641527-2-andrew.pinski@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260603020635.2641527-1-andrew.pinski@oss.qualcomm.com> References: <20260603020635.2641527-1-andrew.pinski@oss.qualcomm.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: PsagArNOdff-NjT-Y6RF0h7VlbSAe0n8 X-Authority-Analysis: v=2.4 cv=Ev3iaycA c=1 sm=1 tr=0 ts=6a1f8c38 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=jpuWWtznm249gNHsVapybA==:17 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=EGmfsc7rQBwRx5XI3bMA:9 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-GUID: PsagArNOdff-NjT-Y6RF0h7VlbSAe0n8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjAzMDAxNyBTYWx0ZWRfXwCDWfGTEPQgI VtfAOIcDTdW9VyA4bInlNgWh+826cwuij8zip1cwn0+VSqLNq7ntgzzCBWw6EgyG+Kkr+UVlWNO i4vZ9yOSAOyeREoI6Ew/Y2BKtjigijPcMj5aiSkFkVs0F4Q6ic+eNL0JMnTs7/AzzujTa0XBL/U cQi7errGi5tFvUBWXEkqUPaLFJ4H3gaRu50JdLeG38yZf5uT0R9pNq6yBLMH3MqylwqtWqVFXv9 lBsEcnQUTa6Qy52rb+8QohiVJnBOBlP0TZ7UrPY8W0W6FOg28+58pRtz/FHK1OZC66WucCTOGMJ +JcXe0WVJxkWcp0r9n4Hr/uZAfuAuu1Kny7mmlD/BjD/yTZ7I0UL9tW42vv9kF/3l0BrQpZAKVJ uNwMZKZGLNBU1SmOPYd+xeXa/dvqHEVbaTTn6yVTp4DduNzKCRQ6FOAhAcoNBOC3T2va2QhCD2Q EWXalk9EVMM3ekdmyUg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-03_01,2026-05-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605210000 definitions=main-2606030017 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_PBL, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org EVRP changes some statements into copies but then does not do copy prop during its handling. This causes in some cases where phiopt could have optimized the phi not to be done. So we should move the copy prop pass (sccopy) right after evrp instead of after phiopt. Notes on the testsuite changes: dse-points-to.c needs to disable sccopy1 for the same reason why it disables all other copyprop passes. pr45397.c had an xfail for specifically PR 103221. pr81981.c is about a missing warning, in this case moving sccopy swaps around which uses is first in the list. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/103221 gcc/ChangeLog: * passes.def (early_optimizations): Move sccopy to after evrp. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/dse-points-to.c: Disable sccopy1. * gcc.dg/tree-ssa/pr45397.c: Remove the xfail. * gcc.dg/ubsan/pr81981.c: Swap around which one is xfailed. Signed-off-by: Andrew Pinski --- gcc/passes.def | 2 +- gcc/testsuite/gcc.dg/tree-ssa/dse-points-to.c | 2 +- gcc/testsuite/gcc.dg/tree-ssa/pr45397.c | 8 +++----- gcc/testsuite/gcc.dg/ubsan/pr81981.c | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/gcc/passes.def b/gcc/passes.def index cdddb87302f..1fc867fae51 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -94,6 +94,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_phiprop); NEXT_PASS (pass_fre, true /* may_iterate */); NEXT_PASS (pass_early_vrp); + NEXT_PASS (pass_sccopy); NEXT_PASS (pass_merge_phi); NEXT_PASS (pass_dse); NEXT_PASS (pass_cd_dce, false /* update_address_taken_p */, true /* remove_unused_locals */); @@ -104,7 +105,6 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_tail_recursion); NEXT_PASS (pass_if_to_switch); NEXT_PASS (pass_convert_switch); - NEXT_PASS (pass_sccopy); NEXT_PASS (pass_profile); NEXT_PASS (pass_local_pure_const); NEXT_PASS (pass_modref); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/dse-points-to.c b/gcc/testsuite/gcc.dg/tree-ssa/dse-points-to.c index 762d6720143..ff84ba8db13 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/dse-points-to.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/dse-points-to.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fno-tree-vrp -fdump-tree-dse1-details" } */ +/* { dg-options "-O2 -fno-tree-ccp -fno-tree-forwprop -fno-tree-fre -fno-tree-vrp -fdisable-tree-sccopy1 -fdump-tree-dse1-details" } */ int f () diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr45397.c b/gcc/testsuite/gcc.dg/tree-ssa/pr45397.c index 8eacb518777..37e57a8996c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr45397.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr45397.c @@ -18,12 +18,10 @@ int foo_mul (const unsigned char *tmp, int i, int val) /* All cases should end up using min/max for the saturated operations and have no control flow. */ -/* EVRP leaves copies in the IL which confuses phiopt1 so we have - to rely on phiopt2 instead. */ /* { dg-final { scan-tree-dump-not " & 255;" "evrp" } } */ -/* { dg-final { scan-tree-dump-times "MAX_EXPR" 3 "phiopt1" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-not "if " "phiopt1" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "MAX_EXPR" 3 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt1" } } */ +/* { dg-final { scan-tree-dump-not "if " "phiopt1" } } */ /* { dg-final { scan-tree-dump-times "MAX_EXPR" 3 "phiopt2" } } */ /* { dg-final { scan-tree-dump-times "MIN_EXPR" 3 "phiopt2" } } */ /* { dg-final { scan-tree-dump-not "if " "phiopt2" } } */ diff --git a/gcc/testsuite/gcc.dg/ubsan/pr81981.c b/gcc/testsuite/gcc.dg/ubsan/pr81981.c index d201efb3f65..8aac5ae9725 100644 --- a/gcc/testsuite/gcc.dg/ubsan/pr81981.c +++ b/gcc/testsuite/gcc.dg/ubsan/pr81981.c @@ -16,6 +16,6 @@ foo (int i) u[0] = i; } - v = u[0]; /* { dg-warning "may be used uninitialized" "" { xfail *-*-* } } */ - return t[0]; /* { dg-warning "may be used uninitialized" } */ + v = u[0]; /* { dg-warning "may be used uninitialized" } */ + return t[0]; /* { dg-warning "may be used uninitialized" "" { xfail *-*-* } } */ }