[PATCH] Add debugging helpers for ranger.

Andrew MacLeod amacleod@redhat.com
Tue Jun 15 13:43:33 GMT 2021


On 6/15/21 7:55 AM, Jakub Jelinek via Gcc-patches wrote:
> On Tue, Jun 15, 2021 at 01:47:41PM +0200, Aldy Hernandez via Gcc-patches wrote:
>> +// =========================================
>> +// Debugging helpers.
>> +// =========================================
>> +
>> +// Query all statements in the IL to precalculate computable ranges in RANGER.
> Not a review, just a random nit.
> The above comment doesn't match what the function is actually doing:
>
>> +
>> +static DEBUG_FUNCTION void
>> +debug_seed_ranger (gimple_ranger &ranger)
>> +{
>> +  // Recalculate SCEV to make sure the dump lists everything.
>> +  if (scev_initialized_p ())
>> +    {
>> +      scev_finalize ();
>> +      scev_initialize ();
>> +    }
>> +
>> +  basic_block bb;
>> +  int_range_max r;
>> +  FOR_EACH_BB_FN (bb, cfun)
>> +    {
>> +      gimple *last = last_stmt (bb);
>> +      if (last && gimple_get_lhs (last))
>> +	ranger.range_of_stmt (r, last);
> which is only doing it for the last stmts in the basic blocks if any.
> So e.g. in the common case of GIMPLE_COND at the end of a bb it does
> nothing.
>
> 	Jakub
>
In fact, you can simply drop the gimple_get_lhs (last) part of the 
condition... range_of_stmt works just fine without a LHS, and will then 
calculate the GIMPLE_COND operands.

Andrew



More information about the Gcc-patches mailing list