This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: fix PR66726 regression for min/max/conversion combo from PR71016 patch
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Joern Wolfgang Rennecke <joern dot rennecke at riscy-ip dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 1 Jul 2019 13:38:56 +0200
- Subject: Re: RFA: fix PR66726 regression for min/max/conversion combo from PR71016 patch
- References: <5D19EA7E.5060802@riscy-ip.com>
On Mon, Jul 1, 2019 at 1:22 PM Joern Wolfgang Rennecke
<joern.rennecke@riscy-ip.com> wrote:
>
> The heuristic introduced for PR71016 prevents recognizing a max / min
> combo like it is used for
> saturation when followed by a conversion.
> The attached patch refines the heuristic to allow this case. Regression
> tested on x86_64-pc-linux-gnu .
Few style nits:
if (!gsi_end_p (gsi))
- return NULL;
+ {
+ gimple *assign = gsi_stmt (gsi);
+ if (gimple_code (assign) != GIMPLE_ASSIGN)
+ return NULL;
if (gassign *assign = dyn_cast <gassign *>
(gsi_stmt (gsi)))
{
+ tree lhs = gimple_assign_lhs (assign);
+ enum tree_code ass_code = gimple_assign_rhs_code (assign);
+ if (ass_code != MAX_EXPR && ass_code != MIN_EXPR)
+ return NULL;
+ gsi_prev_nondebug (&gsi);
+ if (!gsi_end_p (gsi))
+ return NULL;
}
else
return NULL;
+ }
also please check that 'lhs' is equal to gimple_assing_rhs1 (arg0_def_stmt)
otherwise you'd also allow MIN/MAX unrelated to the conversion detected.
On x86 I see the MIN_EXPR is already detected by GENERIC folding,
I wonder if that is required or if we can handle the case without in one
phiopt pass invocation as well.
Otherwise looks good to me.
Thanks,
Richard.