[patch] Plug loophole in string store merging

Jeff Law law@redhat.com
Thu Nov 19 17:30:02 GMT 2020



On 11/19/20 8:52 AM, Eric Botcazou wrote:
> Hi,
>
> there is a loophole in new string store merging support I added recently: it 
> does not check that the stores are consecutive, which is obviously required if 
> you want to concatenate them...  Simple fix attached, the nice thing being 
> that it can fall back to the regular processing if any hole is detected in the 
> series of stores, thanks to the handling of STRING_CST by native_encode_expr.
>
> Tested on x86-64/Linux, OK for the mainline?
>
>
> 2020-11-19  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* gimple-ssa-store-merging.c (struct merged_store_group): Add
> 	new 'consecutive' field.
> 	(merged_store_group): Set it to true.
> 	(do_merge): Set it to false if the store is not consecutive and
> 	set string_concatenation to false in this case.
> 	(merge_into): Call do_merge on entry.
> 	(merge_overlapping): Likewise.
>
>
> 2020-11-19  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* gnat.dg/opt90a.adb: New test.
> 	* gnat.dg/opt90b.adb: Likewise.
> 	* gnat.dg/opt90c.adb: Likewise.
> 	* gnat.dg/opt90d.adb: Likewise.
> 	* gnat.dg/opt90e.adb: Likewise.
> 	* gnat.dg/opt90a_pkg.ads: New helper.
> 	* gnat.dg/opt90b_pkg.ads: Likewise.
> 	* gnat.dg/opt90c_pkg.ads: Likewise.
> 	* gnat.dg/opt90d_pkg.ads: Likewise.
> 	* gnat.dg/opt90e_pkg.ads: Likewise.
OK
jeff



More information about the Gcc-patches mailing list