(And move the merge logic to IR/Metadata.h)
Also note that I am not sure if it is safe to merge the TBAA part in this way. (Especially when using new struct path tbaa)
Maybe also a testcase using new struct path tbaa would be handy ?
You are merging aa information of adjacent stores here. For the pure 'struct path tbaa' this should be fine. For the 'new' struct path tbaa, there is a problem, as that one also tracks the offset/size of the the tbaa tag information. For that reason, I think that a (new) 'mergeAdjacent' is better, as that one can throw away the tbaa info (or adapt the offset/size when compatible) when in 'new struct path tbaa' mode.