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.
Showing
- gcc/gimple-ssa-store-merging.c 14 additions, 4 deletionsgcc/gimple-ssa-store-merging.c
- gcc/testsuite/gnat.dg/opt90a.adb 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90a.adb
- gcc/testsuite/gnat.dg/opt90a_pkg.ads 15 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90a_pkg.ads
- gcc/testsuite/gnat.dg/opt90b.adb 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90b.adb
- gcc/testsuite/gnat.dg/opt90b_pkg.ads 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90b_pkg.ads
- gcc/testsuite/gnat.dg/opt90c.adb 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90c.adb
- gcc/testsuite/gnat.dg/opt90c_pkg.ads 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90c_pkg.ads
- gcc/testsuite/gnat.dg/opt90d.adb 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90d.adb
- gcc/testsuite/gnat.dg/opt90d_pkg.ads 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90d_pkg.ads
- gcc/testsuite/gnat.dg/opt90e.adb 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90e.adb
- gcc/testsuite/gnat.dg/opt90e_pkg.ads 16 additions, 0 deletionsgcc/testsuite/gnat.dg/opt90e_pkg.ads
Loading
Please register or sign in to comment