[PATCH] Add stmt context in simplify_using_ranges.

Aldy Hernandez aldyh@redhat.com
Wed Jun 30 06:20:18 GMT 2021

On 6/29/21 9:09 PM, Andrew MacLeod wrote:
> We added context to a lot of simplify_using_ranges, but we didn't catch 
> all the places.   This provides the originating stmt to the missing 
> cases which resolve a few EVRP testcases when running in ranger-only mode.
> Bootstraps on x86_64-pc-linux-gnu with no regressions.  Pushed.
> Andrew

Thanks for doing this.  I've done a half-assed job at passing context 
around; probably only when it yielded a discrepancy with evrp.

>  bool
> -simplify_using_ranges::op_with_boolean_value_range_p (tree op)
> +simplify_using_ranges::op_with_boolean_value_range_p (tree op, gimple *s)
>  {
>    if (TYPE_PRECISION (TREE_TYPE (op)) == 1)

I know you like single letter arguments, but I find them confusing when 
the method is more than a few lines long.  Besides, "stmt" is what is 
used throughout vr-values.c.

And speaking of passing statements around, I wonder if it'd be best to 
have m_stmt and possible m_gsi as class fields.  After all, we never 
change them, and they're used by most methods.


More information about the Gcc-patches mailing list