From patchwork Mon Nov 4 20:19:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 288246 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 96EA42C0079 for ; Tue, 5 Nov 2013 07:20:17 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; q=dns; s=default; b=ibYFY9NZNn2UkeT/u2Kp0yOPJB9bH8nXmH+p3E9tTR0 jykhDTX2Le4zsWXNAxUEW+M00moRDNR3tbLGn0bVmdQYesifBiHMSq5xCv97IYzI YuCjyh+QFUiUxnslPlaRxl1hat0JD7TCT/ve+jhfjT5rsBvSVD38Un8IMNjG7cSs = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:reply-to:mime-version:content-type; s=default; bh=uqqLwJeNY9wlws50aMGyPaJTmkc=; b=Cmnd2Lcdh8ad+nXb+ fqI0mlHYdO4tC7urBdJmlZPytKb0PAXvZWPQ2hrp2ajcmuwmQSQxB4h1UTfR16ox 88nUJhG6n6BoH4A7U6oCkRPdO9Bh+yId7mQ/7f21TnkikOWKNcqayn9CN44vxUJR Tqni/A50lyHyZiB/+spxCc6Xq0= Received: (qmail 15004 invoked by alias); 4 Nov 2013 20:19:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14995 invoked by uid 89); 4 Nov 2013 20:19:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, RDNS_NONE, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Nov 2013 20:19:57 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA4KJo8J003318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 4 Nov 2013 15:19:50 -0500 Received: from tucnak.zalov.cz (vpn1-5-212.ams2.redhat.com [10.36.5.212]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rA4KJmBk025924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 4 Nov 2013 15:19:49 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id rA4KJlnZ000366 for ; Mon, 4 Nov 2013 21:19:48 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id rA4KJlLF000365 for gcc-patches@gcc.gnu.org; Mon, 4 Nov 2013 21:19:47 +0100 Date: Mon, 4 Nov 2013 21:19:47 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix a regression caused by my __builtin_unreachable assertion changes (PR tree-optimization/58978) Message-ID: <20131104201947.GY27813@tucnak.zalov.cz> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi! single_imm_use (to my surprise) modifies what it's last argument points to even when returning false, this function wasn't expecting that. Furthermore, if a the var is used in a store which does't have lhs as SSA_NAME, this would ICE. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk as obvious. 2013-11-04 Jakub Jelinek PR tree-optimization/58978 * tree-vrp.c (all_imm_uses_in_stmt_or_feed_cond): Don't modify use_stmt by single_imm_use directly. Only call single_imm_use on SSA_NAMEs. * gcc.c-torture/compile/pr58978.c: New test. Jakub --- gcc/tree-vrp.c.jj 2013-11-04 11:27:35.694278458 +0100 +++ gcc/tree-vrp.c 2013-11-04 16:16:59.607689824 +0100 @@ -6472,13 +6472,14 @@ all_imm_uses_in_stmt_or_feed_cond (tree FOR_EACH_IMM_USE_FAST (use_p, iter, var) if (USE_STMT (use_p) != stmt) { - gimple use_stmt = USE_STMT (use_p); + gimple use_stmt = USE_STMT (use_p), use_stmt2; if (is_gimple_debug (use_stmt)) continue; while (is_gimple_assign (use_stmt) + && TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME && single_imm_use (gimple_assign_lhs (use_stmt), - &use2_p, &use_stmt)) - ; + &use2_p, &use_stmt2)) + use_stmt = use_stmt2; if (gimple_code (use_stmt) != GIMPLE_COND || gimple_bb (use_stmt) != cond_bb) return false; --- gcc/testsuite/gcc.c-torture/compile/pr58978.c.jj 2013-11-04 16:16:18.542905275 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr58978.c 2013-11-04 16:16:18.542905275 +0100 @@ -0,0 +1,16 @@ +/* PR tree-optimization/58978 */ + +int +foo (int x) +{ + switch (x) + { + case 0: + case 1: + case 9: + break; + default: + __builtin_unreachable (); + } + return x; +}