[PATCH] simplify get_range_strlen interface

Jeff Law jeffreyalaw@gmail.com
Mon Nov 15 22:42:21 GMT 2021



On 11/15/2021 3:05 PM, Martin Sebor via Gcc-patches wrote:
> The deeply nested PHI handling in get_range_strlen_dynamic makes
> the code bigger and harder to follow than it would be if done in
> its own function.  The attached patch does that.
>
> In addition, the get_range_strlen family of functions use a bitmap
> to avoid infinite recursion.  Rather than dynamically allocating
> and freeing it on demand the attached patch simplifies the code
> by using an instance of auto_bitmap.  This avoids the risk of
> neglecting to deallocate the bitmap.
>
> Tested on x86_64-linux.
>
> Martin
>
> gcc-get_range_strlen_dynamic.diff
>
> Slightly simplify get_range_strlen interface.
>
> gcc/ChangeLog:
>
> 	* gimple-fold.c (get_range_strlen): Take bitmap as an argument rather
> 	than a pointer to it.
> 	(get_range_strlen_tree): Same.  Remove bitmap allocation.  Use
> 	an auto_bitmap.
> 	(get_maxval_strlen): Use an auto_bitmap.
> 	* tree-ssa-strlen.c (get_range_strlen_dynamic): Factor out PHI
> 	handling...
> 	(get_range_strlen_phi): ...into this function.
> 	(printf_strlen_execute): Dump pointer query cache contents when
> 	details are requisted.
No really a bugfix, but I'll go ahead and ACK for the trunk. Obviously 
the bar is going to be going up now that we're in stage3 :-)

jeff


More information about the Gcc-patches mailing list