This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Setup predicate for switch default case in IPA (PR ipa/91089)
- From: Feng Xue OS <fxue at os dot amperecomputing dot com>
- To: Martin Jambor <mjambor at suse dot cz>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Fri, 30 Aug 2019 08:02:07 +0000
- Subject: Re: [PATCH] Setup predicate for switch default case in IPA (PR ipa/91089)
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2BN6rObUgu7mwl08KZFZ+uKD9v8hskPIaFwHQg+bG7E=; b=VbcW7d+fNZ6bkCv86kYtVyOjKQaZ0yOKf/UUAw6YWSy3Q+4iQPAR1Nv5SVARIQnRCbVxGLagThDUaL5kC0TfqXyeL/Lgmy1iT4ebZIgk/O1ndtarXRp8cw0drS4hxmQyNNMH0JKGglNavkUYZllWM4qulxKwjXAhkte8/kDgz2UHxajhBLlOtr166sX5WyYhndHSZFdqV8B4sKBzWSHKVoQfLPo2ScTCZZ0rQBzpBxa2hzcUvnncx+mxebZU9Hj35XtgrPpcWfhaH/GB7Qbuo7N+ImungrLc20ohyoDB21o5oHhZTo1dWsmKqYvoCrH4noDX2IOB5yLql8xpYK0Ojg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAS66dY1ZFCi5UGNeS4SD05sMPxtaTs+SDGPcY2Pz/Ofm41aN/APkF84+dK7Vi+7WNnGbEeKR/PcjEJANEIAghKnrplH04p/AchasBGh72C7FZVAxehVUXcP+xGqSG9fQ5nbvHYCqVgWMpckv/EBlvbUB0eUx8UE9JIpwh2K05q4fB4EldlJixJYDRz5QaNxrDUrx72BR3J/frOUwFcfSTSQ99n6VWqIJSmq63CSzKVGSwi4mpKvZdqLdUpVLzGI5QKCoTa61V9i2C6z7xMENxeQ/81+HUIHzs261WbHaMkTpJgjyqO+IuoWZvKcydFv3NLpCRP+WkA8gpxamqxikg==
- References: <BYAPR01MB48690FF0F2D7FCFE48DC17B7F7F20@BYAPR01MB4869.prod.exchangelabs.com>,<ri6imqgaufd.fsf@suse.cz>
That's good. Thanks for your comments.
Feng
________________________________________
From: Martin Jambor <mjambor@suse.cz>
Sent: Thursday, August 29, 2019 11:00 PM
To: Feng Xue OS; gcc-patches@gcc.gnu.org; Jan Hubicka
Subject: Re: [PATCH] Setup predicate for switch default case in IPA (PR ipa/91089)
Hi,
On Fri, Jul 12 2019, Feng Xue OS wrote:
> IPA does not construct executability predicate for default case of switch statement.
> So execution cost of default case is not properly evaluated in IPA-cp, this might
> prevent function clone for function containing switch statement, if certain non-default
> case is proved to be executed after constant propagation.
>
> This patch is composed to deduce predicate for default case, if it turns out to be a
> relative simple one, for example, we can try to merge case range, and use
> comparison upon range bounds, and also range analysis information to simplify
> predicate.
>
I have read through the patch and it looks OK to me but I cannot approve
it, you have to ping Honza for that. Since you decided to use the value
range info, it would be nice if you could also add a testcase where it
plays a role. Also, please don't post changelog entries as a part of
the patch, it basically guarantees it will not apply for anybody, not
even for you when you update your trunk.
Thanks for working on this,
Martin
> Feng
>
> ----
> diff --git a/gcc/ChangeLog b/gcc/ChangeLog
> index 3d92250b520..4de2f568990 100644
> --- a/gcc/ChangeLog
> +++ b/gcc/ChangeLog
> @@ -1,3 +1,10 @@
> +2019-07-12 Feng Xue <fxue@os.amperecomputing.com>
> +
> + PR ipa/91089
> + * ipa-fnsummary.c (set_switch_stmt_execution_predicate): Add predicate
> + for switch default case using range analysis information.
> + * params.def (PARAM_IPA_MAX_SWITCH_PREDICATE_BOUNDS): New.
> +
> 2019-07-11 Sunil K Pandey <sunil.k.pandey@intel.com>
>