From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id 8AA483858D32 for ; Mon, 16 Jan 2023 07:29:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8AA483858D32 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-lj1-x233.google.com with SMTP id bn6so29086335ljb.13 for ; Sun, 15 Jan 2023 23:29:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PSXsJZ0WR0Rsfjt4rHoeD9z8WkOTQAm46Uapi/WN42U=; b=WG9/3Gs2gIvI1igRCTIBHx4Lh/NYpvPDikDRN3ID1BTULCwOWc3q9p/Q7npV1VrLLr 4rQy8iystAg9uwVTMF/PXzneWRIv83LbcK0TQW0JUIydbCbokCJmESI/UoI8tKFmFqg1 u8F5cHVQgOMDiztKBR3QtvMzij4w7B0mtxbRJj/3X+UZ8VSA0pfBwqpROwMu7zPg4SgL 910U+GwWd1U7qQI6QmSdkikW9gg5ASfdkPWWj6fqI+p1HQNvh5GEcSuJqzzujxPZ2LTo OA9JkGq9pCTafhnHPwq+z/qluGNW+ZCZmHImaZ62QeQUGkiPZucltkqN5kdmmgdX84ck +L3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=PSXsJZ0WR0Rsfjt4rHoeD9z8WkOTQAm46Uapi/WN42U=; b=THKaMkPGBsusfAXuOQG40gNwami9NyGIrr9WpRn0Z4TntmOjuel9KST6j/RUIoQJYm sZWcYTEiBncakAaQ9dYS0orMZ+JLsjv5KSbODx73pOta5HphBCD7n6ZgumMWDXptYi06 WPksc77p32rr84tVx9upRPubfi6QE/o4WL3P+qkw6nlo1gN/7MhushUojdvZp/OO83nJ fymxJcoq1mwxxEyndxe+YsQUshlIJPFVxFyF2MVqMm3c5uIFM763B2wvcSUavusovB5H aBFHHhXoHPheVTY+KdJlm1ZV0tH2ct1IVI8rhBjQVhjgp8bHchmB3mjgLq7mDYE9XyXB uqHQ== X-Gm-Message-State: AFqh2krSf1yDXIDUmtC77h512n2Kz2uPkAASm2WsJhNNs4rNpV/hmUZE 0p2C5VzCEbVmeBFQXcoXmG92qvQGp+L4kL5xgPc= X-Google-Smtp-Source: AMrXdXt4d5YQ4AFEV6K4R34XPu7QSkrAeThKDl6PGMdrp1OLN7T/YMuUulw7YbfAhqKze0ugOkg6BXUU5AJzA6MmFn8= X-Received: by 2002:a2e:2285:0:b0:285:d819:2b56 with SMTP id i127-20020a2e2285000000b00285d8192b56mr1075236lji.467.1673854155167; Sun, 15 Jan 2023 23:29:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 16 Jan 2023 08:29:03 +0100 Message-ID: Subject: Re: [PR106746] drop cselib addr lookup in debug insn mem To: Alexandre Oliva Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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 Sat, Jan 14, 2023 at 12:26 PM Alexandre Oliva via Gcc-patches wrote: > > > The testcase used to get scheduled differently depending on the > presence of debug insns with MEMs. It's not clear to me why those > MEMs affected scheduling, but the cselib pre-canonicalization of the > MEM address is not used at all when analyzing debug insns, so the > memory allocation and lookup are pure waste. Somehow, avoiding that > waste fixes the problem, or makes it go latent. > > Regstrapped on x86_64-linux-gnu. Ok to install? OK. Richard. > > for gcc/ChangeLog > > PR debug/106746 > * sched-deps.cc (sched_analyze_2): Skip cselib address lookup > within debug insns. > > for gcc/testsuite/ChangeLog > > PR debug/106746 > * gcc.dg/target/i386/pr106746.c: New. > --- > gcc/sched-deps.cc | 36 +++++++++++++++--------------- > gcc/testsuite/gcc.target/i386/pr106746.c | 29 ++++++++++++++++++++++++ > 2 files changed, 47 insertions(+), 18 deletions(-) > create mode 100644 gcc/testsuite/gcc.target/i386/pr106746.c > > diff --git a/gcc/sched-deps.cc b/gcc/sched-deps.cc > index f9371b81fb41e..a9214f674329a 100644 > --- a/gcc/sched-deps.cc > +++ b/gcc/sched-deps.cc > @@ -2605,26 +2605,26 @@ sched_analyze_2 (class deps_desc *deps, rtx x, rtx_insn *insn) > > case MEM: > { > - /* Reading memory. */ > - rtx_insn_list *u; > - rtx_insn_list *pending; > - rtx_expr_list *pending_mem; > - rtx t = x; > - > - if (sched_deps_info->use_cselib) > - { > - machine_mode address_mode = get_address_mode (t); > - > - t = shallow_copy_rtx (t); > - cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1, > - GET_MODE (t), insn); > - XEXP (t, 0) > - = cselib_subst_to_values_from_insn (XEXP (t, 0), GET_MODE (t), > - insn); > - } > - > if (!DEBUG_INSN_P (insn)) > { > + /* Reading memory. */ > + rtx_insn_list *u; > + rtx_insn_list *pending; > + rtx_expr_list *pending_mem; > + rtx t = x; > + > + if (sched_deps_info->use_cselib) > + { > + machine_mode address_mode = get_address_mode (t); > + > + t = shallow_copy_rtx (t); > + cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1, > + GET_MODE (t), insn); > + XEXP (t, 0) > + = cselib_subst_to_values_from_insn (XEXP (t, 0), GET_MODE (t), > + insn); > + } > + > t = canon_rtx (t); > pending = deps->pending_read_insns; > pending_mem = deps->pending_read_mems; > diff --git a/gcc/testsuite/gcc.target/i386/pr106746.c b/gcc/testsuite/gcc.target/i386/pr106746.c > new file mode 100644 > index 0000000000000..14f7dab71d691 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/i386/pr106746.c > @@ -0,0 +1,29 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fsched2-use-superblocks -fcompare-debug -Wno-psabi" } */ > + > +typedef char __attribute__((__vector_size__ (64))) U; > +typedef short __attribute__((__vector_size__ (64))) V; > +typedef int __attribute__((__vector_size__ (64))) W; > + > +char c; > +U a; > +U *r; > +W foo0_v512u32_0; > + > +void > +foo (W) > +{ > + U u; > + V v; > + W w = __builtin_shuffle (foo0_v512u32_0, foo0_v512u32_0); > + u = > + __builtin_shufflevector (a, u, 3, 0, 4, 9, 9, 6, 7, 8, 5, > + 0, 6, 1, 8, 1, 2, 8, 6, > + 1, 8, 4, 9, 3, 8, 4, 6, 0, 9, 0, 1, 8, 2, 3, 3, > + 0, 4, 9, 9, 6, 7, 8, 5, > + 0, 6, 1, 8, 1, 2, 8, 6, > + 1, 8, 4, 9, 3, 8, 4, 6, 0, 9, 0, 1, 8, 2, 3); > + v *= c; > + w &= c; > + *r = (U) v + (U) w; > +} > > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > Disinformation flourishes because many people care deeply about injustice > but very few check the facts. Ask me about