<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 08/23/2016 12:18 PM, Daniel Berlin
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAF4BwTXoAc9mHWtVZZu-rJ=E2EG_FcaUn5s0VaUbDKukATc=7Q@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Aug 23, 2016 at 12:04 PM,
            Philip Reames <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:listmail@philipreames.com" target="_blank">listmail@philipreames.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">reames
              added inline comments.<br>
              <br>
              ================<br>
              Comment at: lib/Transforms/Scalar/<wbr>DeadStoreElimination.cpp:490<br>
              @@ -489,3 +489,3 @@<br>
                 // Do a top-down walk on the BB.<br>
                 for (BasicBlock::iterator BBI = BB.begin(), BBE =
              BB.end(); BBI != BBE; ) {<br>
                   Instruction *Inst = &*BBI++;<br>
              ----------------<br>
              I'm wondering whether we can solve the practical problem
              with a caching change.<br>
              <br>
              What if we simply chose to cache the intermediate MDA
              results?  (Note that MDA does not do this for the
              getPointerDependencyFrom interface.)<br>
            </blockquote>
            <div>FWIW: It's caching is also mostly broken for
              getNonLocalPointerDependency (if you call it 100000 times
              on the same inputs, you can see this).</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <br>
              I'm picturing a simple cache structure of
              Map<pair<MemoryLoc, Instruction>,
              MemDepResult><br>
            </blockquote>
            <div><br>
            </div>
            <div>This is hugely expensive in practice if you keep the
              cache ;)</div>
            <div><br>
            </div>
            <div>This is precisely what we did in MemorySSA back in the
              day, and i did precisely this with GVN before i started
              building MemorySSA.  The memory usage on larger testcases
              is "huge", to say the least.</div>
            <div>MemoryLoc's are not very cheap these days.</div>
            <div><br>
            </div>
            <div>They are Ptr, Size, AATags (which is a struct with 3
              pointers).</div>
            <div>They are copied by value everywhere, too :(</div>
            <div><br>
            </div>
            <div>If we had an LRU (or whatever) cache datastructure,
              where we could say "store 100 things", this would probably
              make for a good stopgap.</div>
          </div>
        </div>
      </div>
    </blockquote>
    This seems like a very reasonable thing to implement.  <br>
    <blockquote
cite="mid:CAF4BwTXoAc9mHWtVZZu-rJ=E2EG_FcaUn5s0VaUbDKukATc=7Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <br>
              This wouldn't reduce the worst case complexity (it could
              be each instruction has a different memory location
              associated with it which is may alias with all others),</blockquote>
            <div><br>
            </div>
            <div>It's not just memloc, they could have different size or
              tbaa, etc.</div>
          </div>
        </div>
      </div>
    </blockquote>
    Isn't that part of the memory location class?  (Oh, I see the
    confusion.  I didn't mean "location in memory"; I meant "location in
    memory as described by a "MemoryLoc". )<br>
    <blockquote
cite="mid:CAF4BwTXoAc9mHWtVZZu-rJ=E2EG_FcaUn5s0VaUbDKukATc=7Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
            </div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex"> but how
              many unique memory locations do we see in practice?  And
              out of those, how many are mayalias (i.e. not a possible
              read or def which terminates a chain)?<br>
            </blockquote>
            <div><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>