From patchwork Fri Aug 5 12:31:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 56558 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D15A385AC0A for ; Fri, 5 Aug 2022 12:32:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D15A385AC0A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659702747; bh=4/6nFCiL5xKfb2K4gEk9gQezjeVrfURhUILOFWdGPLo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=psAdD55Wb0kYKE8WU3yxyBTd8sFQdEvirDOCo/daM/fJP7gs3I/E0DZ+cInJ34KKz CSOHx3hC89P7obxMT1M18jJ1h0zKtnC1osBgKaj0pBOc/DGgDL6QLvowfao+0Vvy9A Si7OD4IX3iUoY+62BME+tzto+dtm9KkV0fOfN3Oo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 411E13858C53 for ; Fri, 5 Aug 2022 12:31:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 411E13858C53 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A3F5B1FCA3 for ; Fri, 5 Aug 2022 12:31:56 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8F62313A9C for ; Fri, 5 Aug 2022 12:31:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +zW6IbwN7WJQGwAAMHmgww (envelope-from ) for ; Fri, 05 Aug 2022 12:31:56 +0000 Date: Fri, 5 Aug 2022 14:31:56 +0200 (CEST) To: gcc-patches@gcc.gnu.org Subject: [PATCH] backthreader dump fix MIME-Version: 1.0 Message-Id: <20220805123156.8F62313A9C@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" This fixes odd SUCCEEDED dumps from the backthreader registry that can happen even though register_jump_thread cancelled the thread as invalid. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-ssa-threadbackward.cc (back_threader::maybe_register_path): Check whether the registry register_path rejected the path. (back_threader_registry::register_path): Return whether register_jump_thread succeeded. --- gcc/tree-ssa-threadbackward.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gcc/tree-ssa-threadbackward.cc b/gcc/tree-ssa-threadbackward.cc index 3acd66a7780..332a1d2a1dd 100644 --- a/gcc/tree-ssa-threadbackward.cc +++ b/gcc/tree-ssa-threadbackward.cc @@ -243,10 +243,9 @@ back_threader::maybe_register_path () bool irreducible = false; if (m_profit.profitable_path_p (m_path, m_name, taken_edge, &irreducible) - && debug_counter ()) + && debug_counter () + && m_registry.register_path (m_path, taken_edge)) { - m_registry.register_path (m_path, taken_edge); - if (irreducible) vect_free_loop_info_assumptions (m_path[0]->loop_father); } @@ -858,8 +857,7 @@ back_threader_registry::register_path (const vec &m_path, } push_edge (jump_thread_path, taken_edge, EDGE_NO_COPY_SRC_BLOCK); - register_jump_thread (jump_thread_path); - return true; + return register_jump_thread (jump_thread_path); } // Thread all suitable paths in the current function.