On Wed, Feb 26, 2020 at 09:09:11AM +0100, Richard Biener wrote: > > Note, as I said in the PR, for GCC11 we could consider performing some kind > > of cheap DSE during the store merging (perhaps guarded with flag_tree_dse). > > And another thing to consider is only consider as problematic non-mergeable > > stores that not only have order smaller than last_order as currently, but > > also have order larger than first_order, as in this testcase if we actually > > ignored (not merged with anything at all) the 192/32/0 store, because it is > > not in between the other stores we'd merge, it would be fine to merge the > > other 3 stores, though of course the testcase can be easily adjusted by > > putting the 192/32 store after the 128/32 store and then this patch would be > > still needed. Though, I think I'd need more time thinking this over. > > When looking at the PR I thought that the issue must be with the sorting > since if there's no intermediate store breaking the chain we should be > able to "merge" all INTEGER_CSTs by simply native encoding them in > program order? (similar to what VN does with partial defs)
They are actually merged in the program order, there is stores.qsort (sort_by_order); at the start of apply_stores, it is just that for the decisions what to coalesce together it is better to process them in the bitpos order to find out easily what is adjacent, overlapping etc. Jakub