From patchwork Thu Sep 22 22:24:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kugan Vivekanandarajah X-Patchwork-Id: 76820 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp265469qgf; Thu, 22 Sep 2016 15:24:54 -0700 (PDT) X-Received: by 10.98.196.206 with SMTP id h75mr7281195pfk.156.1474583093938; Thu, 22 Sep 2016 15:24:53 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id s4si3855685pal.280.2016.09.22.15.24.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Sep 2016 15:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-436668-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-436668-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-436668-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=X5trVfePNiTIM+p6BunnXorxP5eBz5GNWyGEYgw3QhFgeBolWu tWltaFXo3L4lOjE/opUVtRteKPWnj5RkBvwf2QgimlZa/qOXU/fJnwCtz7SgdsW6 +gldAJYSCDGa1MrPRTruJGuCgu/ubRoUbdKqyOY7JRclYFa7N86i1J/mk= 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:from :to:cc:subject:message-id:date:mime-version:content-type; s= default; bh=36AnjQaKSny4ejokbQ1LQ9EFTgo=; b=itbU4A3RyzPfhJuCTse9 6Nmgry0j+S19UQP7v+CGC/J0W0+lCMTkyGOOhtzYpXMEwUrA/o2J407kFGN++Z+k ab3XVUkVlZY389cN49gXRugIqOxWOXliL8kRMzZ6HCEBvxv6A42L/Ylr+upbQKIT lIpk9B9N9+1NuobtQedEU/k= Received: (qmail 38188 invoked by alias); 22 Sep 2016 22:24:41 -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 38177 invoked by uid 89); 22 Sep 2016 22:24:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=20160923, 2016-09-23, HX-Received:10.98.159.194 X-HELO: mail-pf0-f181.google.com Received: from mail-pf0-f181.google.com (HELO mail-pf0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 22 Sep 2016 22:24:30 +0000 Received: by mail-pf0-f181.google.com with SMTP id s13so461291pfd.2 for ; Thu, 22 Sep 2016 15:24:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:message-id:date:user-agent :mime-version; bh=fJpmaFzxENMjSzz+S11B5+3SsMFPX2yxHgWCM6cTWKM=; b=ZH0bFFMA1L25wJWo/SSasuB0Qi9p4NBcoKE3bcB+Ojuf26vfqRGVVgfil+khbx13jS 322DA94hBGgCJ1WhEqb8CFzhU7wPjRGUnUWbzGOqmzXdKoPf2qR4bZeSp0EEe3rDz72C yZ6Kj/bTt1GmtCUCZb9Km+5gNet5SvejpmgkKeLUrFjXxIiOCM6EUQo+iByfWCbjf+tg rZ+ORdoLwtxw0tCltQpj1lL7BYxiOLsaAkEAfoHFxqRusyFVdyNe+/KwXs/NtD6qjuqQ KzJMBAL2IZEGlRLm0hZH4ZJfdlKsQI0zAhSOWBLDtbpiEaxgZ129bN6GyXvy6eZAFvl4 pLjA== X-Gm-Message-State: AE9vXwOQGF0QM0iQEzmGHbrreAuBupM6y1W2VeD4/jXuhXEOFo93blm0180iMxAvsORSXA9k X-Received: by 10.98.159.194 with SMTP id v63mr7080068pfk.91.1474583068930; Thu, 22 Sep 2016 15:24:28 -0700 (PDT) Received: from [10.1.1.7] (58-6-183-210.dyn.iinet.net.au. [58.6.183.210]) by smtp.gmail.com with ESMTPSA id e21sm6250027pfb.96.2016.09.22.15.24.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Sep 2016 15:24:27 -0700 (PDT) From: kugan To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener , Martin Jambor , Jan Hubicka Subject: ICE at -O1 and above in both 32-bit and 64-bit modes on x86_64-linux-gnu Message-ID: Date: Fri, 23 Sep 2016 08:24:23 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, As Richard pointed out in PR77677, TREE_OVERFLOW is not cleared in IPA-VRP. There are three places in which we set value_range: 1. When value ranges are obtained from SSA_NAME with get_range_info with wide_int_to_tree. In this case we will not have TREE_OVERFLOW set. 2. When we vrp_meet/vrp_intersect_ranges two ranges. It does int_const_binop but AFAIK this does not set TREE_OVERFLOW. 3. When we create range from constant. This is the problem bit and we need to clear TREE_OVERFLOW here. Attached patch clears the TREE_OVERFLOW in 3rd case. Bootstrap and regression testing are ongoing. Is this OK if there is no regression. Thanks, Kugan gcc/ChangeLog: 2016-09-23 Kugan Vivekanandarajah PR ipa/77677 * ipa-cp.c (propagate_vr_accross_jump_function):Drop TREE_OVERFLOW from constant while creating value range. gcc/testsuite/ChangeLog: 2016-09-23 Kugan Vivekanandarajah PR ipa/77677 * gcc.dg/torture/pr77677.c: New test. diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index cb60f1e..f735ef7 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -2065,6 +2065,8 @@ propagate_vr_accross_jump_function (cgraph_edge *cs, tree val = ipa_get_jf_constant (jfunc); if (TREE_CODE (val) == INTEGER_CST) { + if (TREE_OVERFLOW_P (val)) + val = drop_tree_overflow (val); jfunc->vr_known = true; jfunc->m_vr.type = VR_RANGE; jfunc->m_vr.min = val; diff --git a/gcc/testsuite/gcc.dg/torture/pr77677.c b/gcc/testsuite/gcc.dg/torture/pr77677.c index e69de29..af3f0b0 100644 --- a/gcc/testsuite/gcc.dg/torture/pr77677.c +++ b/gcc/testsuite/gcc.dg/torture/pr77677.c @@ -0,0 +1,18 @@ +/* PR ipa/77677 */ +/* { dg-do compile } */ + +int a, b; + +static void fn1 (short p1) +{ + a = -p1; + if (a || b) + __builtin_printf ("%d\n", b); +} + +int main () +{ + int c[] = { 40000 }; + fn1 (c[0]); + return 0; +}