This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Setup predicate for switch default case in IPA (PR ipa/91089)
- From: Martin Jambor <mjambor at suse dot cz>
- To: Feng Xue OS <fxue at os dot amperecomputing dot com>, "gcc-patches\@gcc.gnu.org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 29 Aug 2019 17:00:06 +0200
- Subject: Re: [PATCH] Setup predicate for switch default case in IPA (PR ipa/91089)
- References: <BYAPR01MB48690FF0F2D7FCFE48DC17B7F7F20@BYAPR01MB4869.prod.exchangelabs.com>
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
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,
> 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 <firstname.lastname@example.org>
> + 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 <email@example.com>