<div dir="ltr">and this could be solved by not stopping the walk until you hit liveonentry. This is one of the rare cases where optimizing uses makes the algorithm slower, but this is also because the only real solution is in fact, different chains than we do now<div>(you want the upward use set.  If we build a form, this will be sparse and a single user, if not, it's a set)<br><div><div><br><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 10:04 AM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, this is the issue where I said "it assumes certain things about aliasing" :)<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 14, 2016 at 9:04 AM, Geoff Berry <span dir="ltr"><<a href="mailto:gberry@codeaurora.org" target="_blank">gberry@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>I don't think this is right.  Consider attempting to hoist the
      store %p just before the load in the following case:<br>
    </p>
    <pre><tt>store @A </tt><tt><tt>; 1 = MemoryDef(LiveIn)</tt>
load @B ; MemoryUse(LiveIn)
store %p ; 2 = MemoryDef(1)</tt>
</pre>
    You won't see the load as a use of store @A because it has been
    optimized to point to LiveOnEntry, so it will appear that it is safe
    to hoist it when it is not.<div><div><br>
    <br>
    <div>On 9/13/2016 7:38 PM, Daniel Berlin
      wrote:<br>
    </div>
    <blockquote type="cite">
      <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->getClobberingAc<wbr>cess(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(OriginalSto<wbr>re, 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<wbr>, HoistPoint))<br>
          </div>
          <div>   
OuterWorklist.push_back(cachin<wbr>gWalker->getClobberingAccess(C<wbr>urrentStore->getDefiningAccess<wbr>()))</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>
    </blockquote>
    <br>
    </div></div><span><font color="#888888"><pre cols="72">-- 
Geoff Berry
Employee of Qualcomm Datacenter Technologies, Inc.
 Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.</pre>
  </font></span></div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div>