On Fri, Jun 17, 2016 at 5:31 PM, Kyrill Tkachov <kyrylo.tkac...@foss.arm.com> wrote: > Hi all, > > I'm working on a tree-ssa pass to implement PR 22141, a pass that merges > adjacent stores. > I've gotten to the point where I can identify the adjacent accesses, merge > them into a single value > and am now working on emitting the new statements but, as I don't have a lot > of experience with the gimple > machinery, am not sure what to do about alias sets and other bookkeeping. > > At the point where I'm emitting the single wide store to replace a number of > narrow consecutive stores > I construct a MEM_REF that I assign the wide merged value to. > I think I need to also set its alias info but am not sure how to construct > it. > > Conceptually I need the disjunction of all the alias sets of the stores that > the new store replaces > but I'm not sure how to get that. I can get the alias set of a single gimple > statement through > get_alias_set of the LHS of each gimple assignment but how do I merge them? > I don't see a helper function for that that springs to mind...
There are reference_alias_ptr_type and alias_ptr_types_compatible_p. When you get a false from the latter you have to use ptr_type_node (you get alias-set zero from that). > Also, from what I understand gimple statements that write to memory have > these vdef operands but I'm > not sure what the vdef operand for the new store that replaces the series of > adjacent stores should be > set to (or how to construct it). Use the VDEF from the last store and the VUSE from the earliest. You can also get them re-built via update-ssa but that's expensive. Richard. > > Any guidance on this would be very appreciated. > > Thanks, > Kyrill