From patchwork Tue Oct 24 10:30:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 157371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp1844748vqx; Tue, 24 Oct 2023 03:31:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWfNcqBILqyvgbv0rWtQtAKo7F9qViuxI4SbZSUvXBy9I/q1qmet3AdeBM/eQoToQGD7P/ X-Received: by 2002:a05:622a:2c9:b0:419:8f42:8c45 with SMTP id a9-20020a05622a02c900b004198f428c45mr14878860qtx.8.1698143479502; Tue, 24 Oct 2023 03:31:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698143479; cv=pass; d=google.com; s=arc-20160816; b=KEXulVw4wSTk0XTL+xr88u/XJLgB4Qj7Jd3oCPtLSW00rG1+E/wtsqpoSmPGiWD6ai uUeFdR1jpZqGcdDSnfBmjTfPUGk8TXT5/tRUTjMO6zO0joCSQ8WcB7ZmXz1PbHrkojeX W+8b/1uAUhYONHLZB+qiOg6rNmeTC9haB6NpXWu3QU2unmButVxEoWVvT2Efs77W0V3q B6taaKkoxfGgK0H/MksAr+wvlGpgIfYLjKM/7uVUcYscF9uc+ohvsBlCHwCmMWqnUj+W CNnA5O3HlciLk8LBJPfpYYZ0bYbQ+8Gwv7d63Z9W6aZfW7LjXuuwCOaJjJaB0VKrT6RX +Eyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:arc-filter:dmarc-filter:delivered-to; bh=FHmLXry/0tRTr+Wrx2KI9m7l6JxBuV6fLBJdkZWhVSY=; fh=C4nEn4uRKApr1WsFtLyJD8L5BeRuRc+JFyqoopFjd9M=; b=JewgPno1qoSNicrhLIQnzksAUqcjVuPJ8YuYY3gzyAE55x65hckSDRN6Pf9fmnXeWj QJuzAp2iz81IfGDnKiSL0Agxn3U8y+OcsAdspSgen5VMFNhYzW89Nhpr4Bn8QaHhxZnG pQhL7Ji7app4NnXpGtECCJ55zldMN5B834KxWrSfpKiIosKDVWsSnk2LCAgdL1dSwogw dcMCUx5dnp6KKUvbg06d/QYuXlhsPOLaURjNCw/3VKglnoo8YFdd83jGqwG7qe5wQGEc +07mCZyr0iD6H047nTdEiaYydk9hFpr8Qy/ww+JK3xY0zfdZxhg25ICvBGKH+db143hd F1tw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x9-20020ac85f09000000b0041974779343si6638355qta.479.2023.10.24.03.31.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 03:31:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6329D3856DE8 for ; Tue, 24 Oct 2023 10:31:16 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 976A33858284 for ; Tue, 24 Oct 2023 10:30:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 976A33858284 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 976A33858284 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698143451; cv=none; b=dQpqK3+4+zLoj7rP2ezHp3EBoMqfXkZ6dhXk9xTcMkkhJxMJN2IUd1hhNmArqhCfcoWwRS4oFOoKDZA2S+utBaKbgskc+IIQhruIom7CGa/fuoXAUm53Jx0r0d0X2dzT5O+mbg2umjLpiHtlTr/dsHN0iwRlrpItgvaw3XsRBt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698143451; c=relaxed/simple; bh=mFK7hXORNfQXV9NnzbdwVY7TD1qhzky5JCvXV1N8zM0=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=Zz3+7WxGRU5Nv1+Qmn6HoUidSeluRRiOMsmvR4iE8v1XtIaZnC1LzPhrBF5tTYn5jyxysRNQQR6iZd33J+1gAoaywcWOCPueYDbxwAKrMIdIPcAxek48ELd70o/VH82zhGMBKVJuob91W0GlIejQnHG10fku/y6XMj3RM0AGQRY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4C962C15; Tue, 24 Oct 2023 03:31:22 -0700 (PDT) Received: from e121540-lin.manchester.arm.com (e121540-lin.manchester.arm.com [10.32.110.72]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CFFA83F64C; Tue, 24 Oct 2023 03:30:40 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Cc: Richard Sandiford Subject: [PATCH 4/4] rtl-ssa: Avoid creating duplicated phis Date: Tue, 24 Oct 2023 11:30:00 +0100 Message-Id: <20231024103000.3334790-5-richard.sandiford@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231024103000.3334790-1-richard.sandiford@arm.com> References: <20231024103000.3334790-1-richard.sandiford@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-24.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, 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 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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780632497288615674 X-GMAIL-MSGID: 1780632497288615674 If make_uses_available was called twice for the same use, we could end up trying to create duplicate definitions for the same extended live range. gcc/ * rtl-ssa/blocks.cc (function_info::create_degenerate_phi): Check whether the requested phi already exists. --- gcc/rtl-ssa/blocks.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/rtl-ssa/blocks.cc b/gcc/rtl-ssa/blocks.cc index d46cbf1e388..ecce7a68c59 100644 --- a/gcc/rtl-ssa/blocks.cc +++ b/gcc/rtl-ssa/blocks.cc @@ -525,6 +525,11 @@ function_info::create_phi (ebb_info *ebb, resource_info resource, phi_info * function_info::create_degenerate_phi (ebb_info *ebb, set_info *def) { + // Allow the function to be called twice in succession for the same def. + def_lookup dl = find_def (def->resource (), ebb->phi_insn ()); + if (set_info *set = dl.matching_set ()) + return as_a (set); + access_info *input = def; phi_info *phi = create_phi (ebb, def->resource (), &input, 1); if (def->is_reg ())