This is an archive of the discontinued LLVM Phabricator instance.

[polly] Introduce -polly-print-* passes to replace -analyze.
ClosedPublic

Authored by Meinersbur on Mar 1 2022, 3:43 PM.

Details

Summary

The opt -analyze option only works with the legacy pass manager and might be removed in the future, as explained in llvm.org/PR53733. This patch introduced -polly-print-* passes that print what the pass would print with the -analyze option and replaces all uses of -analyze in the regression tests.

There are two exceptions: CodeGen\single_loop_param_less_equal.ll and CodeGen\loop_with_condition_nested.ll use -analyze on the -loops` pass which is not part of Polly.

Diff Detail

Event Timeline

Meinersbur created this revision.Mar 1 2022, 3:43 PM
Herald added a project: Restricted Project. · View Herald Transcript
Meinersbur requested review of this revision.Mar 1 2022, 3:43 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 1 2022, 3:43 PM
Meinersbur retitled this revision from [polly] Introduce -polly-print-* passes to replace -analyze to [polly] Introduce -polly-print-* passes to replace -analyze..Mar 1 2022, 3:44 PM

for the remaining -analyze -loops tests, do the polly passes in those tests have new PM equivalents?
-passes='print<loops>' should be a suitable replacement for -loops -analyze

aeubanks accepted this revision.Mar 2 2022, 11:38 AM
This revision is now accepted and ready to land.Mar 2 2022, 11:38 AM

for the remaining -analyze -loops tests, do the polly passes in those tests have new PM equivalents?
-passes='print<loops>' should be a suitable replacement for -loops -analyze

CodeGen/single_loop_param_less_equal.ll
; RUN: opt %loadPolly -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS
CodeGen\loop_with_condition_nested.ll
; RUN: opt %loadPolly -basic-aa -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS

-polly-codegen does not emit anything with -analyze. It is testing which loops after -polly-codegen. Therefore, this could be equivalent using the NPM:

; RUN: opt %loadPolly -passes="function(scop(polly-codegen),print<loops>)" -disable-output < %s 2>&1 | FileCheck %s -check-prefix=LOOPS

However, it is failing due to how differently the NPM works.

for the remaining -analyze -loops tests, do the polly passes in those tests have new PM equivalents?
-passes='print<loops>' should be a suitable replacement for -loops -analyze

CodeGen/single_loop_param_less_equal.ll
; RUN: opt %loadPolly -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS
CodeGen\loop_with_condition_nested.ll
; RUN: opt %loadPolly -basic-aa -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS

-polly-codegen does not emit anything with -analyze. It is testing which loops after -polly-codegen. Therefore, this could be equivalent using the NPM:

; RUN: opt %loadPolly -passes="function(scop(polly-codegen),print<loops>)" -disable-output < %s 2>&1 | FileCheck %s -check-prefix=LOOPS

However, it is failing due to how differently the NPM works.

based on local testing even something like opt %loadPolly -basic-aa -polly-codegen < %s | opt -enable-new-pm=0 -loops -analyze fails the same way. even opt %loadPolly -basic-aa -polly-codegen -barrier -loops -analyze does the same thing, so it seems like some sort of interaction between the scheduling of Region passes and the loop printing
-debug-pass=Structure doesn't show anything suspicious though

Pass Arguments:  -targetlibinfo -tti -assumption-cache-tracker -profile-summary-info -domtree -basic-aa -loops -postdomtree -domfrontier -regions -scalar-evolution -lazy-branch-prob -lazy-block-freq -opt-remark-emitter -aa -polly-detect -polly-scops -polly-dependences -polly-ast -polly-codegen -verify
Target Library Information
Target Transform Information
Assumption Cache Tracker
Profile summary info
  ModulePass Manager
    FunctionPass Manager
      Dominator Tree Construction
      Basic Alias Analysis (stateless AA impl)
      FunctionPass Printer: Basic Alias Analysis (stateless AA impl)
      Natural Loop Information
      Post-Dominator Tree Construction
      Dominance Frontier Construction
      Detect single entry single exit regions
      Scalar Evolution Analysis
      Lazy Branch Probability Analysis
      Lazy Block Frequency Analysis
      Optimization Remark Emitter
      Function Alias Analysis Results
      Polly - Detect static control parts (SCoPs)
      Region Pass Manager
        Polly - Create polyhedral description of Scops
        Polly - Calculate dependences
        Polly - Generate an AST from the SCoP (isl)
        Polly - Create LLVM-IR from SCoPs
        RegionPass Printer: Polly - Create LLVM-IR from SCoPs
      FunctionPass Printer: Natural Loop Information
      Module Verifier

and verifying the loop info doesn't show any issues

This revision was landed with ongoing or failed builds.Mar 14 2022, 8:28 AM
This revision was automatically updated to reflect the committed changes.

based on local testing even something like opt %loadPolly -basic-aa -polly-codegen < %s | opt -enable-new-pm=0 -loops -analyze fails the same way. even opt %loadPolly -basic-aa -polly-codegen -barrier -loops -analyze does the same thing

LoopInfo just prints the blocks it contains as they appear in the LoopBase::Blocks vector. The order is different between the depth-first order when LoopInfo is constructed from scratch, versus when preserved by adding/removing elements from the list. LoopBase::verifyLoop allows Blocks to be in a different order.

polly/test/ScopInfo/licm_potential_store.ll