From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id F14CF3858CDA for ; Wed, 26 Apr 2023 09:50:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F14CF3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4eed6ddcae1so29749548e87.0 for ; Wed, 26 Apr 2023 02:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682502619; x=1685094619; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4baQe9WCv5IquiGPwmJ5bqa2XeLXNkpOahgLaxbBvpA=; b=WIqqFw2ukHogfYpvgHYg396cWdTKSuDkxHBDaRUs5aQhCmpFmrehdAFTFg3GM0endf qTWy3nRRt/L/6695fLM/+KsNXzfn3ICGiQbuEWtixTs/3mCPI1+zeqSLGDUeRLpFcQby /AjojXahyGqcDSiND5BxBzrADwA+Bx7j0FnbJsAqmZVj66YOKvyHEHtxiRUlq0eShEXQ 3kRePF+DBocpqM4OQpa0UYhO3YdVfih3dd1DsWfkyTVHHB4oAIdj7MvghBoKhrLP1Ir5 kn3izjhzytY9+8WmHbW9ulu4B7fQMv+cPR/kiX6kCdxusjhcLQPAseGjgzO9eDFpDjYp i7FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682502619; x=1685094619; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4baQe9WCv5IquiGPwmJ5bqa2XeLXNkpOahgLaxbBvpA=; b=BDdexCnBkVhuCFpYVjlO2A45bZ28CCd7mB+n3eWPOUe7gVFRXvUEeR8pNHshDFWRrQ AWTwyunWOomtCIL5RyEG6mDiSlnfWT+m5fHwTnpOm1dLYxKQr3ZNBpm2167JdV3UmylL HQGEKX1g473En9tUX2MhxSZiTjnHwcWiirBg0cLfhcvfARCUpgdmbuc7lRPk59a+Jm9o YH+1asij+ns1jH4LiuFXtsYT4ZN39X1A5jOZDJnXiQtKebel51q6FyuSr8Ag7eHGuAvJ +L92l2Dby4OjaR/ZkXmadeBhKYnnuqCQdvV8oG/8zTYtvwQ7/bGmqL9nuMW/XbPBejTy nVqA== X-Gm-Message-State: AC+VfDzGAWucCiVe6RYqyK4NJqqs4EN+46WJTMKHBXzZWLvPlySrjJfC eoHJcM/DTzhUMYY6ATmvSwkfHhLyheW4tsRZivXk0td4 X-Google-Smtp-Source: ACHHUZ7WHnyK7HPHeyN2LngjbAMh9AtTfvu95bOL/lXhlsDQmF2zyq+dWvWJAKEZwDiImoyb9KVHxNWi0d4w0n318vY= X-Received: by 2002:a05:651c:11cf:b0:2a9:7985:b2f5 with SMTP id z15-20020a05651c11cf00b002a97985b2f5mr516311ljo.24.1682502619172; Wed, 26 Apr 2023 02:50:19 -0700 (PDT) MIME-Version: 1.0 References: <3493207.iIbC2pHGDl@fomalhaut> <4477930.LvFx2qVVIh@fomalhaut> In-Reply-To: <4477930.LvFx2qVVIh@fomalhaut> From: Richard Biener Date: Wed, 26 Apr 2023 11:48:50 +0200 Message-ID: Subject: Re: [PATCH] Avoid creating useless debug temporaries To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Apr 26, 2023 at 11:31=E2=80=AFAM Eric Botcazou wrote: > > > probably also helps PR109612 and the other similar PR referenced therei= n. > > Here's a more aggressive patch in this area, but it regresses guality tes= ts, > for example: > > +FAIL: gcc.dg/guality/ipa-sra-1.c -O2 -DPREVENT_OPTIMIZATION line 27 = k =3D=3D > 3 > +FAIL: gcc.dg/guality/ipa-sra-1.c -O3 -g -DPREVENT_OPTIMIZATION line = 27 k > =3D=3D 3 > +FAIL: gcc.dg/guality/ipa-sra-1.c -Os -DPREVENT_OPTIMIZATION line 27 = k =3D=3D > 3 > > eric@fomalhaut:~/build/gcc/native> diff -u ipa-sra-1.c.254t.optimized.0 i= pa- > sra-1.c.254t.optimized > --- ipa-sra-1.c.254t.optimized.0 2023-04-26 11:12:07.806357325 +02= 00 > +++ ipa-sra-1.c.254t.optimized 2023-04-26 11:24:08.632874257 +0200 > @@ -101,7 +101,6 @@ > # DEBUG k =3D> k_5 > # DEBUG BEGIN_STMT > _1 =3D get_val1 (); > - # DEBUG D#6 =3D> k_5 > r_8 =3D foo.isra (_1); > # DEBUG r =3D> r_8 > # DEBUG BEGIN_STMT > > and I don't understand why yet. interesting. So that removes unmentioned debug temporaries? I think remove_unused_locals does something to debug stmts as well (but from a quick look cannot decipher what it actually does). On the RTL level delete_trivially_dead_insns does wipe some (redundant) debug_insns, there's no exact match to that on the GIMPLE side either. I'm not sure if DCE is a good place to do this. > > * tree-ssa-dce.cc (find_debug_expr_decl): New callback. > (mark_stmt_if_obviously_necessary): Add DECLS parameters. > : Call find_debug_expr_decl on the value of > DEBUG_BIND statements and record the results in DECLS. > (find_obviously_necessary_stmts): If DEBUG_BIND statements may be > present, get rid of those setting an unnecessary DEBUG_EXPR_DECL. > > -- > Eric Botcazou