summaryrefslogtreecommitdiff
path: root/polly/lib/Analysis/ScopGraphPrinter.cpp
AgeCommit message (Collapse)Author
2025-11-14[Polly] Introduce PhaseManager and remove LPM support (#125442) (#167560)Michael Kruse
Reapply of a22d1c2225543aa9ae7882f6b1a97ee7b2c95574. Using this PR for pre-merge CI. Instead of relying on any pass manager to schedule Polly's passes, add Polly's own pipeline manager which is seen as a monolithic pass in LLVM's pass manager. Polly's former passes are now phases of the new PhaseManager component. Relying on LLVM's pass manager (the legacy as well as the New Pass Manager) to manage Polly's phases never was a good fit that the PhaseManager resolves: * Polly passes were modifying analysis results, in particular RegionInfo and ScopInfo. This means that there was not just one unique and "definite" analysis result, the actual result depended on which analyses ran prior, and the pass manager was not allowed to throw away cached analyses or prior SCoP optimizations would have been forgotten. The LLVM pass manger's persistance of analysis results is not contractual but designed for caching. * Polly depends on a particular execution order of passes and regions (e.g. regression tests, invalidation of consecutive SCoPs). LLVM's pass manager does not guarantee any excecution order. * Polly does not completely preserve DominatorTree, RegionInfo, LoopInfo, or ScalarEvolution, but only as-needed for Polly's own uses. Because the ScopDetection object stores references to those analyses, it still had to lie to the pass manager that they would be preserved, or the pass manager would have released and recomputed the invalidated analysis objects that ScopDetection/ScopInfo was still referencing. To ensure that no non-Polly pass would see these not-completely-preserved analyses, all analyses still had to be thrown away after the ScopPassManager, respectively with a BarrierNoopPass in case of the LPM. * The NPM's PassInstrumentation wraps the IR unit into an `llvm::Any` object, but implementations such as PrintIRInstrumentation call llvm_unreachable on encountering an unknown IR unit, such as SCoPs, with no extension points to add support. Hence LLVM crashes when dumping IR between SCoP passes (such as `-print-before-changed` with Polly being active). The new PhaseManager uses some command line options that previously belonged to Polly's legacy passes, such as `-polly-print-detect` (so the option will continue to work). Hence the LPM support is incompatible with the new approach and support for it is removed.
2025-11-04Revert "[Polly] Introduce PhaseManager and remove LPM support (#125442)"Aiden Grossman
This reverts commit e987ab11a6f3d3965ef26fc42c82db3e8b1d56f5. This broke premerge: 1. https://lab.llvm.org/staging/#/builders/192/builds/9521 2. https://github.com/llvm/llvm-project/actions/runs/19054182009 Notably this did not break inside the PR. Not exactly sure why. I realize that there is a lot of test churn here, but they're largely in polly where commit frequency is much lower, so a reapply of the patch should be clean.
2025-11-03[Polly] Introduce PhaseManager and remove LPM support (#125442)Michael Kruse
Instead of relying on any pass manager to schedule Polly's passes, add Polly's own pipeline manager which is seen as a monolithic pass in LLVM's pass manager. Polly's former passes are now phases of the new PhaseManager component. Relying on LLVM's pass manager (the legacy as well as the New Pass Manager) to manage Polly's phases never was a good fit that the PhaseManager resolves: * Polly passes were modifying analysis results, in particular RegionInfo and ScopInfo. This means that there was not just one unique and "definite" analysis result, the actual result depended on which analyses ran prior, and the pass manager was not allowed to throw away cached analyses or prior SCoP optimizations would have been forgotten. The LLVM pass manger's persistance of analysis results is not contractual but designed for caching. * Polly depends on a particular execution order of passes and regions (e.g. regression tests, invalidation of consecutive SCoPs). LLVM's pass manager does not guarantee any excecution order. * Polly does not completely preserve DominatorTree, RegionInfo, LoopInfo, or ScalarEvolution, but only as-needed for Polly's own uses. Because the ScopDetection object stores references to those analyses, it still had to lie to the pass manager that they would be preserved, or the pass manager would have released and recomputed the invalidated analysis objects that ScopDetection/ScopInfo was still referencing. To ensure that no non-Polly pass would see these not-completely-preserved analyses, all analyses still had to be thrown away after the ScopPassManager, respectively with a BarrierNoopPass in case of the LPM. * The NPM's PassInstrumentation wraps the IR unit into an `llvm::Any` object, but implementations such as PrintIRInstrumentation call llvm_unreachable on encountering an unknown IR unit, such as SCoPs, with no extension points to add support. Hence LLVM crashes when dumping IR between SCoP passes (such as `-print-before-changed` with Polly being active). The new PhaseManager uses some command line options that previously belonged to Polly's legacy passes, such as `-polly-print-detect` (so the option will continue to work). Hence the LPM support is incompatible with the new approach and support for it is removed.
2022-06-04Remove unneeded cl::ZeroOrMore for cl::opt optionsFangrui Song
Similar to 557efc9a8b68628c2c944678c6471dac30ed9e8e. This commit handles options where cl::ZeroOrMore is more than one line below cl::opt.
2022-05-17[Polly] Mark classes as final by default. NFC.Michael Kruse
This make is obivious that a class was not intended to be derived from. NPM analysis pass can unfortunately not marked as final because they are derived from a llvm::Checker<T> template internally by the NPM. Also normalize the use of classes/structs * NPM passes are structs * Legacy passes are classes * structs that have methods and are not a visitor pattern are classes * structs have public inheritance by default, remove "public" keyword * Use typedef'ed type instead of inline forward declaration
2022-05-09[polly] migrate -polly-show to the new pass managerMichael Kruse
Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D123678
2022-05-09[PassManager] Implement DOTGraphTraitsViewer under NPMMichael Kruse
Rename the legacy `DOTGraphTraits{Module,}{Viewer,Printer}` to the corresponding `DOTGraphTraits...WrapperPass`, and implement a new `DOTGraphTraitsViewer` with new pass manager. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D123677
2021-08-18[Polly] Introduce caching for the isErrorBlock function. NFC.Michael Kruse
Compilation of the file insn-attrtab.c of the SPEC CPU 2017 502.gcc_r benchmark takes excessive time (> 30min) with Polly enabled. Most time is spent in the isErrorBlock function querying the DominatorTree. The isErrorBlock is invoked redundantly over the course of ScopDetection and ScopBuilder. This patch introduces a caching mechanism for its result. Instead of a free function, isErrorBlock is moved to ScopDetection where its cache map resides. This also means that many functions directly or indirectly calling isErrorBlock are not "const" anymore. The DetectionContextMap was marked as "mutable", but IMHO it never should have been since it stores the detection result. 502.gcc_r only takes excessive time with the new pass manager. The reason seeams to be that it invalidates the ScopDetection analysis more often than the legacy pass manager, for unknown reasons.
2020-04-06[CFGPrinter][CallPrinter][polly] Adding distinct structure for CFGDOTInfoKirill Naumov
The patch introduces the system to distinctively store the information needed for the Control Flow Graph as well as the instrumentary needed for the follow-up changes: BlockFrequencyInfo and BranchProbabilityInfo. The patch is a part of sequence of three patches, related to graphs Heat Coloring. Reviewers: rcorcs, apilipenko, davidxl, sfertile, fedor.sergeev, eraman, bollu Differential Revision: https://reviews.llvm.org/D76820
2020-01-06[NFC] Fixes -Wrange-loop-analysis warningsMark de Wever
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D72210
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-03-20Adjust to clang-format changesTobias Grosser
llvm-svn: 328005
2017-05-12[Polly][NewPM] Port ScopDetection to the new PassManagerPhilip Pfaffe
Summary: This is a proof of concept of how to port polly-passes to the new PassManager architecture. This approach works ootb for Function-Passes, but might not be directly applicable to Scop/Region-Passes. While we could just run the Analyses/Transforms over functions instead, we'd surrender the nice pipelining behaviour we have now. Reviewers: Meinersbur, grosser Reviewed By: grosser Subscribers: pollydev, sanjoy, nemanjai, llvm-commits Tags: #polly Differential Revision: https://reviews.llvm.org/D31459 llvm-svn: 302902
2016-12-19Fix clang-formatTobias Grosser
llvm-svn: 290103
2016-08-22Migrate from NodeType * to NodeRef.Tim Shen
llvm-svn: 279488
2015-12-17Fix formattingTobias Grosser
llvm-svn: 255892
2015-12-17ScopGraphPrinter: Only show functions that contain at least one scopTobias Grosser
When running 'clang -O3 -mllvm -polly -mllvm -polly-show' we now only show the CFGs of functions with at least one detected scop. For larger files/projects this reduces the number of graphs printed significantly and is likely what developers want to see. The new option -polly-view-all enforces all graphs to be printed and the exiting option -poll-view-only limites the graph printing to functions that match a certain pattern. This patch requires https://llvm.org/svn/llvm-project/llvm/trunk@255889 (and vice versa) to compile correctly. llvm-svn: 255891
2015-08-03Add option -polly-view-onlyTobias Grosser
If set, this option instructs -view-scops and -polly-show to only print functions that contain the specified string in their name. This allows to look at the scops of a specific function in a large .ll file, without flooding the screen with .dot graphs. llvm-svn: 243882
2015-05-03Adding debug location information to Polly's JSCOP and dot exportsTobias Grosser
This change adds location information for the detected regions in Polly when the required debug information is available. The JSCOP output format is extended with a "location" field which contains the information in the format "source.c:start-end" The dot output is extended to contain the location information for each nested region in the analyzed function. As part of this change, the existing getDebugLocation function has been moved into lib/Support/ScopLocation.cpp to avoid having to include polly/ScopDetectionDiagnostics.h. Differential Revision: http://reviews.llvm.org/D9431 Contributed-by: Roal Jordans <r.jordans@tue.nl> llvm-svn: 236393
2015-03-29Avoid nullptr dereference in the ScopGraphPrinterTobias Grosser
Reported-by: http://buildd-clang.debian.net/scan-build llvm-svn: 233505
2014-07-20Update formatting with clang-format.Bill Wendling
llvm-svn: 213468
2014-07-19Update for RegionInfo changes.Matt Arsenault
Mostly related to missing includes and renaming of the pass to RegionInfoPass. llvm-svn: 213457
2014-07-09clang-format polly to avoid buildbot noiseTobias Grosser
llvm-svn: 212609
2014-06-28[C++11] Use more range based forsTobias Grosser
llvm-svn: 211981
2014-04-15Fix more build errors in Polly after r206310. David caught one of theseChandler Carruth
in r206312, but others don't seem to show up on build bots? Unsure of why, they showed up for me. llvm-svn: 206326
2014-03-21clang-format: Remove empty linesTobias Grosser
llvm-svn: 204468
2014-03-03[C++11] Use foreach iterator for blocks and operandsTobias Grosser
llvm-svn: 202707
2013-07-13Small style improvementsTobias Grosser
llvm-svn: 186248
2013-06-23Integrate latest clang-format changesTobias Grosser
llvm-svn: 184655
2013-05-07Sort includesTobias Grosser
llvm-svn: 181297
2013-05-07Reformat with clang-formatTobias Grosser
clang-format become way more stable. This time we mainly reformat function signatures. llvm-svn: 181294
2013-03-23clang-format: Many more filesTobias Grosser
After this commit, polly is clang-format clean. This can be tested with 'ninja polly-check-format'. Updates to clang-format may change this, but the differences will hopefully be both small and general improvements to the formatting. We currently have some not very nice formatting for a couple of items, DEBUG() stmts for example. I believe the benefit of being clang-format clean outweights the not perfect layout of this code. llvm-svn: 177796
2012-12-29Fix obvious formatting problems.Tobias Grosser
We fix the following formatting problems found by clang-format: - 80 cols violations - Obvious problems with missing or too many spaces - multiple new lines in a row clang-format suggests many more changes, most of them falling in the following two categories: 1) clang-format does not at all format a piece of code nicely 2) The style that clang-format suggests does not match the style used in Polly/LLVM I consider differences caused by reason 1) bugs, which should be fixed by improving clang-format. Differences due to 2) need to be investigated closer to understand the cause of the difference and the solution that should be taken. llvm-svn: 171241
2012-09-08ScopGraphPrinter: Escape error messageTobias Grosser
Otherwise a '"' in the error message, yields an invalid .dot file. llvm-svn: 163466
2012-05-04Update Polly to match the LLVM interface change in r156196.Chandler Carruth
llvm-svn: 156203
2011-11-17Fix placement of the '*' that marks a pointerTobias Grosser
Suggested by Sebastian Pop. llvm-svn: 144902
2011-10-08Show the reason a region is not a SCoP in the DOT graphs.Tobias Grosser
llvm-svn: 141458
2011-04-29Add initial version of PollyTobias Grosser
This version is equivalent to commit ba26ebece8f5be84e9bd6315611d412af797147e in the old git repository. llvm-svn: 130476