[PATCH] Add debugging helpers for ranger.

Andrew MacLeod amacleod@redhat.com
Tue Jun 15 14:05:33 GMT 2021


On 6/15/21 9:48 AM, Jakub Jelinek wrote:
> On Tue, Jun 15, 2021 at 09:43:33AM -0400, Andrew MacLeod wrote:
>>>> +  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.
> But even then, not every stmt in the bb participates in the computation
> of the value (if any) of the last stmt in the block, some stmts could
> compute values only used in the PHIs or in the middle of other bbs,
> others could store to memory, or be calls without return value, ...
> If ranger does caching, can't it just call range_of_stmt on every non-debug
> stmt in the bb?
>
> 	Jakub
>
Yes.  Which is exactly what the old execute() routine use to do to fill 
the cache and dump state.

I suspect this is driven by his threader work, and in that particular 
case, all he cares about is things that are exported so he isn't 
noticing the other things in the middle of the block :-) Should have 
noticed the GIMPLE_CONDS I would have thought. perhaps they were 
collected indirectly if they were relevant.

Andrew



More information about the Gcc-patches mailing list