<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Generally, passes are viewed as rather independent transformations
    of IR,<br>
    so they can be run in any order w/o breaking correctness of
    transformations.<br>
    (there are exceptions to that but they are, well, exceptions).<br>
    <br>
    If you need a particular order of passes for correctness of your
    pass then<br>
    you better reconsider if ever possible.<br>
    <br>
    Yet, as you might imagine, the order of passes matters for the
    quality of optimizations.<br>
    And thats where Pass Manager comes into play, as it controls all the
    aspects of  passes execution.<br>
    So if you need a particular order of passes for the  - you set up
    your Pass Manager appropriately.<br>
    With "opt" the order in which it adds passes to Pass Manager is
    determined by the order of<br>
    command-line pass options:<br>
        opt -cvp -your-pass<br>
    will execute first cvp and then your pass.<br>
    <br>
    regards,<br>
      Fedor.<br>
    <br>
    <div class="moz-cite-prefix">On 3/25/19 11:14 AM, Zi Wang via
      llvm-dev wrote<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHobeRur8rOg1EmF1KoxmCQ243dn6AxMTKVN=sPto9tN8RAGHg@mail.gmail.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div dir="ltr"><br>
        <div class="gmail_quote">
          <div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019 at 3:11
            AM Zi Wang <<a href="mailto:wzahhq9@gmail.com"
              moz-do-not-send="true">wzahhq9@gmail.com</a>> wrote:<br>
          </div>
          <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>
                <div dir="auto">Thanks Fedor!</div>
              </div>
              <div dir="auto"><br>
              </div>
              <div>I did not really use PassManager.h in the source code
                of my pass. I am wondering when you mention "Just add
                CVP into pass manager before your own pass and you
                should be fine." Do you mean Pass Manager on the pass
                source code level, or use "opt" to call CVP first and
                then call my pass? If it is at the source code level, do
                you know any pointer on how to arrange passes using
                PassManager at the source code level?</div>
            </div>
            <div><br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Mon, Mar 25, 2019
                  at 2:46 AM Fedor Sergeev via llvm-dev <<a
                    href="mailto:llvm-dev@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex"> > It will be a
                  great help if anyone can point out how to call the <br>
                  "CalledValuePropagationPass" in my own pass<br>
                  <br>
                  You cant call passes from passes.<br>
                  You can only organize a pipeline, so passes are being
                  run in succession.<br>
                  Just add CVP into pass manager before your own pass
                  and you should be fine.<br>
                  <br>
                  Also, passes are not analyses and doing AU.addRequired
                  on a pass is not <br>
                  a good idea<br>
                  (though sometimes this hack might seem to work).<br>
                  <br>
                  regards,<br>
                     Fedor.<br>
                  <br>
                  On 3/25/19 2:39 AM, Zi Wang via llvm-dev wrote:<br>
                  > Hi,<br>
                  ><br>
                  > I found an existing pass "CalledValuePropagation"
                  that can solve the <br>
                  > problem I raised a few days ago regarding the
                  "callees" metadata <br>
                  > (<a
                    href="https://groups.google.com/forum/#!topic/llvm-dev/yjtZVMH_aC4"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://groups.google.com/forum/#!topic/llvm-dev/yjtZVMH_aC4</a>).
                  Now I <br>
                  > have difficulty in calling this pass in my own
                  pass.<br>
                  ><br>
                  > In my own pass, I called<br>
                  > "getAnalysis<CalledValuePropagationPass>()"<br>
                  ><br>
                  > and in the "getAnalysisUsage(AnalysisUsage
                  &AU)" function, I called<br>
                  >
                  "AU.addRequired<CalledValuePropagationPass>();"<br>
                  ><br>
                  > I got compilation errors:<br>
                  >
                  ----------------------------------------------------------<br>
                  > .....<br>
                  > include/llvm/PassAnalysisSupport.h:223:38: error:
                  ‘ID’ is not a member <br>
                  > of ‘llvm::CalledValuePropagationPass’<br>
                  >    return
                  getAnalysisID<AnalysisType>(&AnalysisType::ID);\<br>
                  > .....<br>
                  > install/include/llvm/PassAnalysisSupport.h:67:39:
                  error: ‘ID’ is not a <br>
                  > member of ‘llvm::CalledValuePropagationPass’<br>
                  >      return addRequiredID(PassClass::ID);<br>
                  > ......<br>
                  >
                  -----------------------------------------------------------<br>
                  ><br>
                  > Looking at the source code of
                  "CalledValuePropagationPass" <br>
                  > (<a
                    href="http://llvm.org/doxygen/CalledValuePropagation_8h_source.html"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">http://llvm.org/doxygen/CalledValuePropagation_8h_source.html</a>),
                  I <br>
                  > found that the class "CalledValuePropagationPass"
                  does not have a <br>
                  > public member "ID" as the passes in the
                  "Transforms/Utils" directory. <br>
                  > All the passes in the "IPO" directory only have a
                  "run()" function <br>
                  > that inherits from the "llvm/IR/PassManager.h". I
                  am not quite sure <br>
                  > how to invoke these passes in my own pass. I used
                  <br>
                  > "UnifyFunctionExitNodes" in my pass and this one
                  worked fine.<br>
                  ><br>
                  > It will be a great help if anyone can point out
                  how to call the <br>
                  > "CalledValuePropagationPass" in my own pass.<br>
                  ><br>
                  > Thanks,<br>
                  ><br>
                  > Zi<br>
                  ><br>
                  > _______________________________________________<br>
                  > LLVM Developers mailing list<br>
                  > <a href="mailto:llvm-dev@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
                  > <a
                    href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
                  <br>
                  _______________________________________________<br>
                  LLVM Developers mailing list<br>
                  <a href="mailto:llvm-dev@lists.llvm.org"
                    target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
                  <a
                    href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
                    rel="noreferrer" target="_blank"
                    moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
                </blockquote>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>