This is the mail archive of the
`gcc@gcc.gnu.org`
mailing list for the GCC project.

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |

Other format: | [Raw text] |

*From*: Richard Biener <rguenther at suse dot de>*To*: pinskia at gmail dot com*Cc*: GCC Mailing List <gcc at gcc dot gnu dot org>*Date*: Fri, 7 Nov 2014 09:10:39 +0100 (CET)*Subject*: Re: Match-and-simplify and COND_EXPR*Authentication-results*: sourceware.org; auth=none*References*: <CA+=Sn1=ZrkDn8FS-5qFvh-ndF2isFD9xBQmE_gLvA6qAVmE02w at mail dot gmail dot com> <alpine dot LSU dot 2 dot 11 dot 1411061126240 dot 27850 at zhemvz dot fhfr dot qr> <alpine dot LSU dot 2 dot 11 dot 1411061138230 dot 27850 at zhemvz dot fhfr dot qr> <CA+=Sn1=3tTc54x87WFQM3+GZeUF9UK35zbWVdY2ymcfqNEMC6A at mail dot gmail dot com> <E7DC8C10-4AAF-44D9-B3E6-4ABEAB027A62 at suse dot de> <FE1F3F8C-23AE-4091-9E8A-4A8DF66E6CFD at gmail dot com>

On Thu, 6 Nov 2014, pinskia@gmail.com wrote: > > > > > > On Nov 6, 2014, at 11:24 PM, Richard Biener <rguenther@suse.de> wrote: > > > >> On November 7, 2014 5:03:19 AM CET, Andrew Pinski <pinskia@gmail.com> wrote: > >> On Thu, Nov 6, 2014 at 2:40 AM, Richard Biener <rguenther@suse.de> > >> wrote: > >>> On Thu, 6 Nov 2014, Richard Biener wrote: > >>> > >>>>> On Wed, 5 Nov 2014, Andrew Pinski wrote: > >>>>> > >>>>> Hi, > >>>>> I was trying to hook up tree-ssa-phiopt to match-and-simplify > >> using > >>>>> either gimple_build (or rather using gimple_simplify depending on > >> if > >>>>> we want to produce cond_expr for conditional move). I ran into a > >>>>> problem. > >>>>> With the pattern below: > >>>>> /* a ? 0 : 1 -> a if 0 and 1 are integral types. */ > >>>>> (simplify > >>>>> (cond_expr @0 integer_zerop integer_onep) > >>>>> (if (INTEGRAL_TYPE_P (type)) > >>>>> (convert @0))) > >>>> > >>>> Ok, so you are capturing a GENERIC expr here but nothing knows that. > >>>> It would work if you'd do (ugh) > >>>> > >>>> (for op (lt le eq ne ge gt) > >>>> (simplify > >>>> (cond_expr (op @0 @1) integer_zerop integer_onep) > >>>> (if (INTEGRAL_TYPE_P (type)) > >>>> (convert (op @0 @1))))) > >>>> (simplify > >>>> (cond_expr SSA_NAME@0 integer_zerop integer_onep) > >>>> (if (INTEGRAL_TYPE_P (type)) > >>>> (convert @0)))) > >>>> > >>>> as a workaround. To make your version work will require (quite) > >>>> some special-casing in the code generator or maybe the resimplify > >>>> helper. Let me see if I can cook up a "simple" fix. > >>> > >>> Sth like below (for the real fix this has to be replicated in > >>> all gimple_resimplifyN functions). I'm missing a testcase > >>> where the pattern would apply (and not be already folded by fold), > >>> so I didn't check if it actually works. > >> > >> You do need to check if seq is NULL though as gimple_build depends on > >> seq not being NULL. But otherwise yes this works for me. > >> > >>> > >>> Bah, of course we should fix COND_EXPRs to not embed a GENERIC > >>> expr... > >> > >> Yes totally agree. For my changes to tree-ssa-phiopt, I no longer > >> embed it. Though we need to change loop ifconvert still. > > > > Istr expansion or code quality does not like us to cse the condition of two cobd_exprs either. After all I had a patch set at some point doing that conversion (though as well for gimple_conds). > > I thought I changed that when I did the expansion of cond_expr into > conditional move. We need to something similar for cond_expr of jumps > too. Well, SSA coalescing may make simple forwarding of the conditions impossible (and TER doesn't work for multiple uses anyway). That said, the most "interesting" issues for cond_exprs of jumps was PRE eliminating partial redundant conditions (thus it noted jump threading opportunities without actually performing the block duplication). Generated code for such PREd conditions was ... "interesting" :/ Richard.

**References**:**Match-and-simplify and COND_EXPR***From:*Andrew Pinski

**Re: Match-and-simplify and COND_EXPR***From:*Richard Biener

**Re: Match-and-simplify and COND_EXPR***From:*Richard Biener

**Re: Match-and-simplify and COND_EXPR***From:*Andrew Pinski

**Re: Match-and-simplify and COND_EXPR***From:*Richard Biener

**Re: Match-and-simplify and COND_EXPR***From:*pinskia

Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|

Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |