From patchwork Mon Nov 14 18:08:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 60607 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 92577382EF0C for ; Mon, 14 Nov 2022 18:09:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92577382EF0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668449343; bh=Ui4WFB2c+8I9o3OHiaRFWghsN5uZkErbgTFoqU/XKiE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jtNmZgCCvdHWp4oSMyXWQm6KHMRgH1djyblfOTZ/oJL8Gv9hxT2A5hm4A2OSMSEO1 axwQYnRKVy6nLkuQbHIfMLyPHk8ewTreTsgAv0/ww+Uxv9Wkj6Cc/Qk8oj8Myj0cI9 Efa65ZidaEWAQk/OAww5Hpry1BYoxGh+yxHNLCLM= 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 796F0385188F for ; Mon, 14 Nov 2022 18:08:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 796F0385188F 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 5F0D72020B for ; Mon, 14 Nov 2022 18:08:32 +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 49DD013A8C for ; Mon, 14 Nov 2022 18:08:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UQjRECCEcmPRbgAAMHmgww (envelope-from ) for ; Mon, 14 Nov 2022 18:08:32 +0000 Date: Mon, 14 Nov 2022 19:08:31 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/107485 - fix non-call exception ICE with inlining MIME-Version: 1.0 Message-Id: <20221114180832.49DD013A8C@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-11.8 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 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" Inlining performs a wrong non-call exception fixup for VEC_COND_EXPRs which on the branch fail to properly have the condition split out in the first place. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed to the GCC 10 branch which is the only one this code snippet prevails. PR tree-optimization/107485 * tree-inline.c (remap_gimple_stmt): Use correct type for split out condition of [VEC_]COND_EXPRs. --- gcc/tree-inline.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index c20c25ceb50..658b09c07d2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1979,11 +1979,10 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id) || gimple_assign_rhs_code (ass) == VEC_COND_EXPR) && gimple_could_trap_p (ass)) { - gassign *cmp - = gimple_build_assign (make_ssa_name (boolean_type_node), - gimple_assign_rhs1 (ass)); + tree def = make_ssa_name (TREE_TYPE (gimple_assign_rhs1 (ass))); + gassign *cmp = gimple_build_assign (def, gimple_assign_rhs1 (ass)); gimple_seq_add_stmt (&stmts, cmp); - gimple_assign_set_rhs1 (ass, gimple_assign_lhs (cmp)); + gimple_assign_set_rhs1 (ass, def); } }