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 *-*-* } } */ }