<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Is this needed if i'm building out of tree? In any case, i am not
      doing INITIALIZE_PASS_DEPENDENCY for DetectKernelsPass and it does
      not complain about it. It basically only complains for any
      Function pass i try to use.<br>
    </p>
    <p>Ees</p>
    <div class="moz-cite-prefix">On 02-10-2020 19:54, Arthur Eubanks
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAPW48sqSVqZ6fgsiNfds9+3UPguN93TPHOUy=98hAGbd=3Js6Q@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>I'm not too familiar with the legacy PM, but perhaps you're
          missing a INITIALIZE_PASS_DEPENDENCY?<br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Oct 2, 2020 at 2:00 AM
          Ees via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org"
            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">
          <div>
            <p>Hi all,</p>
            <p>I am getting the infamous error:</p>
            <p>Assertion `ResultPass && "getAnalysis*() called
              on an analysis that was not " "'required' by pass!"' <br>
            </p>
            <p>but i really don't understand why.</p>
            <p>I have:</p>
            <div>
              <div><span style="color:rgb(56,106,195)">void</span><span
                  style="color:rgb(53,53,53)"> InstrumentationPass</span><span
                  style="color:rgb(53,53,53)">::</span><span
                  style="color:rgb(132,49,197)">getAnalysisUsage</span><span
                  style="color:rgb(53,53,53)">(</span><span
                  style="color:rgb(132,49,197)">llvm</span><span
                  style="color:rgb(53,53,53)">::</span><span
                  style="color:rgb(22,63,228)">AnalysisUsage</span><span
                  style="color:rgb(53,53,53)"> </span><span
                  style="color:rgb(56,106,195)">&</span><span
                  style="color:rgb(224,108,117)">AU</span><span
                  style="color:rgb(53,53,53)">) </span><span
                  style="color:rgb(56,106,195)">const</span><span
                  style="color:rgb(53,53,53)"> {</span></div>
              <div><span style="color:rgb(53,53,53)">    AU.</span><span
                  style="color:rgb(132,49,197)">setPreservesAll</span><span
                  style="color:rgb(53,53,53)">();<br>
                </span></div>
              <div><span style="color:rgb(53,53,53)">    AU.addRequired</span><span
                  style="color:rgb(56,106,195)"><</span><span
                  style="color:rgb(53,53,53)">DetectKernelsPass</span><span
                  style="color:rgb(56,106,195)">></span><span
                  style="color:rgb(53,53,53)">();</span></div>
              <div><span style="color:rgb(53,53,53)">    AU.addRequired</span><span
                  style="color:rgb(56,106,195)"><</span><span
                  style="color:rgb(53,53,53)">SimplifyGEPPass</span><span
                  style="color:rgb(56,106,195)">></span><span
                  style="color:rgb(53,53,53)">()</span></div>
            </div>
            <p>DetectKernelsPass (ModulePass) is a simple analysis pass
              that gathers kernel functions. SimplifyGEPPass
              (FunctionPass) performs some transformations.<br>
            </p>
            <p>InstrumentationPass (ModulePass) is using the others
              like:</p>
            <div>auto kernels =
              getAnalysis<DetectKernelsPass>().getKernels();</div>
            <div>for ( auto* kernel : kernels)</div>
            <div>   
              getAnalysis<SimplifyGEPPass>().runOnFunction(*kernel);<br>
            </div>
            <p><br>
              DetectKernelsPass works fine but i am getting the error
              for SimplifyGEPPass and i can't figure out why. Are
              FunctionPasses not supposed to be used inside ModulePasses
              like that? <br>
            </p>
            <p>I also tried some llvm pass (MemorySSAWrapperPass) but
              i'm getting the same error:</p>
            <p>AnalysisType
              &llvm::Pass::getAnalysisID(llvm::AnalysisID) const
              [AnalysisType = llvm::MemorySSAWrapperPass]: Assertion
              `ResultPass && "getAnalysis*() called on an
              analysis that was not " "'required' by pass!"' f<br>
            </p>
            <p>I would really appreciate some help with this.</p>
            <p>PS. I'm on LLVM 10, building the passes out of tree.</p>
            <p>Ees<br>
            </p>
          </div>
          _______________________________________________<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>
    </blockquote>
  </body>
</html>