From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 97177 invoked by alias); 15 Jul 2016 04:41:02 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 97138 invoked by uid 89); 15 Jul 2016 04:40:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f51.google.com Received: from mail-wm0-f51.google.com (HELO mail-wm0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 15 Jul 2016 04:40:46 +0000 Received: by mail-wm0-f51.google.com with SMTP id o80so12799719wme.1 for ; Thu, 14 Jul 2016 21:40:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=oquk4GhKApTKUiLpLWFw5475sk2I0bfdm0uni0FKQ5g=; b=ChnxWx2zkjjuBPViUpxP/hxmhcXcAAR0mLV3/ksiByvNaTDVbKDHDVCFI/MciA9hAO zhyMWP/qJjNO04Gbk6EyPAbXIg6oN/+RiIHBT52thwyNfFRL5BImHg65yqzDQc8FfzYU 5Ogpq+c/4NmbtLGSwyPq01OuVIFM9apfwx4ozURYB9eERavjHxeWIy3rxWeL8M9mUqT8 q5SUlNUJIceN1pDoRqIsJWMRzqS7nAo2nrLEQ8rtWS2LDkFpKNOEdghx0w3iD9LEC9/z Z1jhZ0mjzHb2DoZsRpV1h9q3tkFsLFQoMYr3Kx2CWD075pjhF7rIQ8ONLDj8XCISGPXQ qPGg== X-Gm-Message-State: ALyK8tKxT+inEsXaF1FD6Dm9c3KiwwyHXKZTRoyPAj/KeipP7q43pANRt41pMlbXAOVoH/N3 X-Received: by 10.28.168.206 with SMTP id r197mr19982298wme.15.1468557643906; Thu, 14 Jul 2016 21:40:43 -0700 (PDT) Received: from [192.168.207.67] ([62.28.188.194]) by smtp.gmail.com with ESMTPSA id r67sm2938175wmb.14.2016.07.14.21.40.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2016 21:40:43 -0700 (PDT) To: "gcc-patches@gcc.gnu.org" Cc: Richard Biener , Jan Hubicka , Martin Jambor From: kugan Subject: [RFC][IPA-VRP] IPA VRP Implementation Message-ID: <57886949.8010300@linaro.org> Date: Fri, 15 Jul 2016 04:41:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-07/txt/msg00888.txt.bz2 Hi, This patch series implements IPA-VRP based on the previous discussions in https://gcc.gnu.org/ml/gcc/2016-01/msg00063.html. 0001-Hack-Prevent-setting-__builtin_constant_p-of-param-t.patch -This is to prevent EVRP setting result of __builtin_constant_p to null that will inlined later. 0002-Inliner-Check-for-POINTER_TYPE.patch - This is to make sure that we call SSA_NAME_PTR_INFO only for POINTER_TYPE_P. This is exposed with IPA-VRP but not related to rest of the patch. 0003-Refactor-vrp.patch - Re-factors tree-vrp to expose some of the common functionalities. 0004-Add-early-vrp.patch - Adds a simple Early VRP pass. 0005-Add-ipa-vrp.patch - Implements IPA VRP 0006-Teach-tree-vrp-to-use-ipa-vrp-results.patch - Teaches tree-vrp to use the value ranges set for the PARMs. More details about the patches are later with each patch. Before I go into the details, here is a simple example and the relevant dumps as of now: static __attribute__((noinline, noclone)) int foo (int i) { if (i > 5) printf ("OK\n"); else printf ("NOK\n"); } int bar (int j) { if (j > 8) return foo (j + 2); else if (j > 2) return foo (j + 3); return 0; } The Early VRP dump shows: _1: [11, +INF(OVF)] _2: [6, 11] .... bar (int j) { .... _8 = foo (_1); goto ; : if (j_5(D) > 2) goto ; else goto ; : _2 = j_5(D) + 3; _10 = foo (_2); .... The IPA-CP dump shows: .... Modification phase of node foo/0 Setting value range of param 0 [6, 2147483647] __attribute__((noclone, noinline)) foo (int i) .... The VRP1 dump shows: Value ranges after VRP: .MEM_1: VARYING i_2(D): [6, +INF] Folding predicate i_2(D) > 5 to 1 Removing basic block 4 Merging blocks 2 and 3 Merging blocks 2 and 5 __attribute__((noclone, noinline)) foo (int i) { : __builtin_puts (&"OK"[0]); return; } I have bootstrapped and regression tested the patches in this series on x86-64 and aarch64 (both normal bootstrap and LTO bootstrap). There are couple of testcase failures which I am looking into. Any thoughts? Thanks, Kugan