<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - New Pass Manager loop passes can't get cached OptimizationRemarkEmitter when invalidated by earlier loop pass"
   href="https://bugs.llvm.org/show_bug.cgi?id=37342">37342</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>New Pass Manager loop passes can't get cached OptimizationRemarkEmitter when invalidated by earlier loop pass
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tejohnson@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I hit the following error when trying to use pass remarks with hotness:

LLVM ERROR: LICM: OptimizationRemarkEmitterAnalysis not cached at a higher
level

from LICMPass, which is trying to get it as cached analysis.

There was a fix done in r292058 to try to keep this analysis valid, however,
that doesn't work if a prior loop pass invalidated it. In my case, it was being
invalidated by LoopSimplifyPass.

I reproduced this by running a loop simplification test with new options:

opt test/Transforms/LoopSimplify/basictest.ll -disable-output
-aa-pipeline=basic-aa 2>&1     
-passes='require<opt-remark-emit>,invalidate<block-freq>,require<opt-remark-emit>,loop(licm)'
-debug-pass-manager      -pass-remarks=licm -pass-remarks-with-hotness

(i.e. the same options being run in the test added for r292058). The tail end
of the output is:

...
Invalidating analysis: OptimizationRemarkEmitterAnalysis on test
Running pass: RequireAnalysisPass<llvm::OptimizationRemarkEmitterAnalysis,
llvm::Function, llvm::AnalysisManager<llvm::Function>> on test
Running analysis: OptimizationRemarkEmitterAnalysis on test
Running analysis: BlockFrequencyAnalysis on test
Running pass: FunctionToLoopPassAdaptor<llvm::PassManager<llvm::Loop,
LoopAnalysisManager, llvm::LoopStandardAnalysisResults &, llvm::LPMUpdater &> >
on test
Starting llvm::Function pass manager run.
Running pass: LoopSimplifyPass on test
Running analysis: AssumptionAnalysis on test
Invalidating all non-preserved analyses for: test
Invalidating analysis: BranchProbabilityAnalysis on test
Invalidating analysis: BlockFrequencyAnalysis on test
Invalidating analysis: OptimizationRemarkEmitterAnalysis on test
Running pass: LCSSAPass on test
Finished llvm::Function pass manager run.
Running analysis: AAManager on test
Running analysis: BasicAA on test
Running analysis: ScalarEvolutionAnalysis on test
Running analysis: TargetIRAnalysis on test
Running analysis: InnerAnalysisManagerProxy<LoopAnalysisManager,
llvm::Function> on test
Starting Loop pass manager run.
Running pass: LICMPass on Loop at depth 1 containing: %bb3<header><latch>
Running analysis: OuterAnalysisManagerProxy<FunctionAnalysisManager,
llvm::Loop, llvm::LoopStandardAnalysisResults &> on bb3
LLVM ERROR: LICM: OptimizationRemarkEmitterAnalysis not cached at a higher
level


Not sure how this is supposed to work or should be fixed.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>