This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][2/5] Add gimple_find_sub_bbs
- From: Richard Biener <rguenther at suse dot de>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Tom de Vries <Tom_deVries at mentor dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Michael Matz <matz at suse dot de>
- Date: Thu, 19 Feb 2015 14:12:22 +0100 (CET)
- Subject: Re: [PATCH][2/5] Add gimple_find_sub_bbs
- Authentication-results: sourceware.org; auth=none
- References: <54E5BB06 dot 2080102 at mentor dot com> <54E5C14D dot 1010609 at mentor dot com> <alpine dot LSU dot 2 dot 11 dot 1502191339290 dot 28824 at zhemvz dot fhfr dot qr> <20150219124858 dot GE1746 at tucnak dot redhat dot com> <20150219125914 dot GA23138 at redhat dot com>
On Thu, 19 Feb 2015, Marek Polacek wrote:
> On Thu, Feb 19, 2015 at 01:48:58PM +0100, Jakub Jelinek wrote:
> > On Thu, Feb 19, 2015 at 01:41:05PM +0100, Richard Biener wrote:
> > > I hope we can get rid of this again (which needs re-writing of all
> > > targets va-arg gimplification hooks... - we are in need of some
> > > generic diamond/triangle CFG pattern builders anyway).
> >
> > We already have some in asan.c - create_cond_insert_point - perhaps
> > it isn't best named and could use some changes to be generally usable.
>
> Yeah, create_cond_insert_point is used in ubsan.c many times, and
> there's nothing *san specific in it.
It's also quite low-level. I'm more looking for sth like
val = gimple_build_cond_value (EQ_EXPR, comp_lhs, comp_rhs,
true_value, true_gimple_seq,
false_value, false_gimple_seq);
which then returns a simplified value (in case all is optimizable
to a constant for example) or produces
if (comp_lhs == comp_rhs)
true_gimple_seq;
else
false_gimple_seq;
val = PHI <true_value, false_value>
so basically allows you to build the true/false values with
gimple_build (or force_gimple_operand for legacy code) and
constructs the diamond/triangle and a PHI together with the
controlling predicate.
Richard.