<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 4/6/12 10:29 AM, Kostya Serebryany wrote:
    <blockquote
cite="mid:CAN=P9piQgx+7JyipsmwM2g-AXU6FdSX9phC62+dY7oR_HgL-2Q@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <br>
      <br>
      <div class="gmail_quote">On Fri, Apr 6, 2012 at 7:50 AM, John
        Criswell <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:criswell@illinois.edu">criswell@illinois.edu</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">
            <div class="im"> On 4/6/12 12:50 AM, Kostya Serebryany
              wrote:
              <blockquote type="cite"> I'd like some similar work to be
                done, although I view it a bit differently. 
                <div>This might be a separate analysis pass that knows
                  nothing about ASAN or SAFECode</div>
                <div>and appends metadata nodes to memory access
                  instructions saying things like</div>
              </blockquote>
              <br>
            </div>
            This is a good idea but is the wrong way to implement the
            idea.  LLVM passes are not required to preserve metadata,
            and even if they were required to do so, there would always
            be a pass with a bug that would fail to preserve the
            metadata properly.  It's an approach that can lead to
            undesired headaches.  Furthermore, you're not guaranteed
            that an instruction that was deemed safe earlier is safe
            after transformation; there are optimizations that LLVM can
            do on C code exhibiting undefined behavior that can change
            it from memory safe to memory-unsafe code.<br>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>Oh, surely the analysis pass should be called directly from
          the instrumentation pass, so that no other pass can
          interfere. </div>
        <div>But a separate pass that marks insns with metadata might be
          easier to test. <br>
        </div>
      </div>
    </blockquote>
    <br>
    An analysis pass can have a print() method that prints its results. 
    You could use something like that to test it.<br>
    <br>
    My point is that metdata should not be used to communicate
    information from an analysis pass to a transform pass; the transform
    pass should simply use getAnalysis() to get a pointer to the
    analysis pass and then query the analysis pass directly.  If you
    want to write a transform pass that queries the analysis pass and
    puts metadata on instructions as a debugging aid, that would be
    fine.<br>
    <br>
    -- John T.<br>
    <br>
  </body>
</html>