<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><br>
</span>I'm not sure the MemSSA will have all the links to be able to walk<br>
the WAR dependences.<br></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>It does not.</div></div></div></div></blockquote><div><br></div>Actually, you can build a walker already that will give you war dependence info.<div><br></div><div>Here is the pseudo code for a getClobberingAccess (note that it is faster to build the entire aliased load set than to call this multiple times. Noted below what to change to do that). Note that it assumes transitivity in aliasing, but this is easy to fix by changing the outerworklist to also include store uses.</div><div><br></div><div>Initialize OuterWorklist to be cachingWalker->getClobberingAccess(OriginalStore)</div><div>while (!OuterWorklist.empty())</div><div> CurrentStore = OuterWorklist.pop_front();</div><div> </div><div> // Any load that is aliased with the store must be a user of the store in use-optimized memoryssa </div><div> for each User of CurrentStore:</div><div> if (isa<MemoryUse>(User))</div><div> UseWorklist.push_back(User)</div><div><br></div><div> while (!UseWorklist.empty())<br></div><div> CurrentAccess = UseWorklist.pop_front();</div><div> if (StoreClobbersLoad(OriginalStore, CurrentAccess)) // This is instructionClobbersQuery, basically</div><div> return CurrentAccess // If you change this to insert it into a set instead of returning, you can get the entire set of dominating aliased loads</div><div><br></div><div> // Keep going up until we've gotten past the attempted hoist point</div><div> if (!MSSA->dominates(CurrentStore, HoistPoint))<br></div><div> OuterWorklist.push_back(cachingWalker->getClobberingAccess(CurrentStore->getDefiningAccess()))</div><div><br></div><div><br></div><div>Note that this should check <= the number of loads than a version that walks all loads does.</div><div><br></div></div></div>