<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 7/14/18 9:21 PM, Muhui Jiang via
      llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAF_eCeqE4o-3jyJfsvuCnGfqdagKCnWP0iibbRE_W8ZU=KDY-w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <div dir="ltr">Hi
        <div><br>
        </div>
        <div>I write a LLVM function pass. The pass will loop the
          basicblock in the function, check the instruction's type with
          dyn_cast<switchinst>, print the instruction and the
          basicblock's successors. I think it is not very complex.</div>
        <div><br>
        </div>
        <div>My bitcode file is about 30M. My CPU is i7-7700(3.6GHz). It
          has been running for 60 hours but it is still running. I am
          not sure whether this is a normal behavior. If so, any options
          or suggestions to help me speed up the analysis. Many Thanks</div>
      </div>
    </blockquote>
    <br>
    The first thing you should check is whether you've written the loop
    properly.  It's possible that you've somehow written an infinite
    loop.  If your pass is adding instructions, be careful that you're
    not invalidating the iterator that you're using to loop over the
    instructions.  That might cause a non-obvious error.<br>
    <br>
    The second thing to consider is to use the InstVisitor class instead
    of writing a loop.  Look at InstVisitor.h in the LLVM source code;
    it has comments that show you how to use it.  In a nutshell, your
    FunctionPass will be a subclass of InstVisitor.  You then implement
    the visitSwitchInst() method and call visit() on the function in
    runOnFunction, and you're done.<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://llvm.org/doxygen/classllvm_1_1InstVisitor.html">http://llvm.org/doxygen/classllvm_1_1InstVisitor.html</a><br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote type="cite"
cite="mid:CAF_eCeqE4o-3jyJfsvuCnGfqdagKCnWP0iibbRE_W8ZU=KDY-w@mail.gmail.com">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Regards</div>
        <div>Muhui</div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
<a class="moz-txt-link-freetext" href="http://www.cs.rochester.edu/u/criswell">http://www.cs.rochester.edu/u/criswell</a></pre>
  </body>
</html>