Skip to content
Snippets Groups Projects
Commit 1b3c9813 authored by Eric Botcazou's avatar Eric Botcazou
Browse files

Plug loophole in string store merging

There is a loophole in new string store merging support 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.

gcc/ChangeLog:
	* 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.

gcc/testsuite/ChangeLog:
	* 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.
parent cd287abe
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment