aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/Analysis.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-05-12[DirectX] Implement DXILResourceImplicitBinding pass (#138043)Helena Kotas1-0/+1
The `DXILResourceImplicitBinding` pass uses the results of `DXILResourceBindingAnalysis` to assigns register slots to resources that do not have explicit binding. It replaces all `llvm.dx.resource.handlefromimplicitbinding` calls with `llvm.dx.resource.handlefrombinding` using the newly assigned binding. If a binding cannot be found for a resource, the pass will raise a diagnostic error. Currently this diagnostic message does not include the resource name, which will be addressed in a separate task (#137868). Part 2/2 of #136786 Closes #136786
2025-05-09[DirectX] Implement DXILResourceBindingAnalysis (#137258)Helena Kotas1-1/+2
`DXILResourceBindingAnalysis` analyses explicit resource bindings in the module and puts together lists of used virtual register spaces and available virtual register slot ranges for each binding type. It also stores additional information found during the analysis such as whether the module uses implicit bindings or if any of the bindings overlap. This information will be used in `DXILResourceImplicitBindings` pass (coming soon) to assign register slots to resources with implicit bindings, and in a post-optimization validation pass that will raise diagnostic about overlapping bindings. Part 1/2 of #136786
2025-04-21[LLVM] Cleanup pass initialization for Analysis passes (#135858)Rahul Joshi1-0/+9
- Do not call pass initialization from pass constructors. - Instead, pass initialization should happen in the `initializeAnalysis` function. - https://github.com/llvm/llvm-project/issues/111767
2025-04-04[NFC][HLSL] Rename ResourceBinding Types (#134165)Ashley Coleman1-1/+1
Non-functional change as first step in https://github.com/llvm/wg-hlsl/pull/207 Removes `Binding` from "Resource Instance" types
2024-12-18[DirectX] Split resource info into type and binding info. NFC (#119773)Justin Bogner1-1/+2
This splits the DXILResourceAnalysis pass into TypeAnalysis and BindingAnalysis passes. The type analysis pass is made immutable and populated lazily so that it can be used earlier in the pipeline without needing to carefully maintain the invariants of the binding analysis. Fixes #118400
2024-08-15[DXIL][Analysis] Boilerplate for DXILResourceAnalysis passJustin Bogner1-0/+1
Broke this out into its own commit to make the next one easier to review. Pull Request: https://github.com/llvm/llvm-project/pull/100700
2024-04-09Remove the unused IntervalPartition analysis pass (#88133)Björn Pettersson1-1/+0
This removes the old legacy PM "intervals" analysis pass (aka IntervalPartition). It also removes the associated Interval and IntervalIterator help classes. Reasons for removal: 1) The pass is not used by llvm-project (not even being tested by any regression tests). 2) Pass has not been ported to new pass manager, which at least indicates that it isn't used by the middle-end. 3) ASan reports heap-use-after-free on ++I; // After the first one... even if false is passed to intervals_begin. Not sure if that is a false positive, but it makes the code a bit less trustworthy.
2023-11-27[NewPM] Remove LazyValueInfoPrinter Pass (#73408)Aiden Grossman1-1/+0
This pass isn't used anywhere upstream and thus has no test coverage. For these reasons, remove it.
2023-11-26[NewPM] Remove CFGPrinterLegacyPass (#73414)Aiden Grossman1-1/+0
This pass has no test coverage in upstream LLVM, is not used anywhere in upstream LLVM, and has a NewPM equivalent. For these reasons, remove it.
2023-11-25[NewPM] Remove CFGOnlyPrinterLegacyPass (#73412)Aiden Grossman1-1/+0
This pass has no test coverage upstream, is not used anywhere upstream, and has a NewPM equivalent. For these reasons, remove it.
2023-11-25[NewPM] Remove CFGOnlyViewerLegacyPass (#73411)Aiden Grossman1-1/+0
This pass has a NewPM equivalent, isn't used anywhere upstream, and doesn't have any test coverage. For these reasons, remove it.
2023-11-25[NewPM] Remove CFGViewerLegacyPass (#73410)Aiden Grossman1-1/+0
This pass isn't used anywhere upstream, has a NewPM equivalent, and has no test coverage. For these reasons, remove it.
2023-11-25[NewPM] Remove CallGraphPrinterLegacyPass (#73409)Aiden Grossman1-1/+0
This pass isn't used anywhere upstream and thus doesn't have any test coverage. For these reasons, remove it.
2023-11-21[NewPM] Remove Delinearization legacy pass (#72942)Aiden Grossman1-1/+0
This pass isn't used/tested anywhere in upstream LLVM, so remove it.
2023-11-21[NewPM] Remove CostModelAnalysis Legacy Pass (#72941)Aiden Grossman1-1/+0
This pass isn't used/tested anywhere upstream, so remove it.
2023-11-21[NewPM] Remove InstCountLegacyPass (#72936)Aiden Grossman1-1/+0
This pass isn't used/tested anywhere upstream, so remove it.
2023-11-06[NewPM] Remove AAEval Legacy Pass (#71358)Aiden Grossman1-1/+0
This patch removes the AAEval legacy pass and associated plumbing. This pass was migrated over to the new pass manager about 11 years ago at this point and there are currently no in-tree users of the legacy pass, so it's essentially just dead code and is completely untested.
2023-06-13[Passes] Remove some legacy printer passesArthur Eubanks1-6/+0
MemDepPrinter doesn't have a new PM equivalent, but MemDep is soft deprecated anyway and adding one should be easy if somebody wants to.
2023-04-21[Lint] Remove legacy passArthur Eubanks1-1/+0
2023-04-17[Analysis] Remove DA & LegacyDApvanhout1-1/+0
UniformityAnalysis offers all of the same features and much more, there is no reason left to use the legacy DAs. See RFC: https://discourse.llvm.org/t/rfc-deprecate-divergenceanalysis-legacydivergenceanalysis/69538 - Remove LegacyDivergenceAnalysis.h/.cpp - Remove DivergenceAnalysis.h/.cpp + Unit tests - Remove SyncDependenceAnalysis - it was not a real registered analysis and was only used by DAs - Remove/adjust references to the passes in the docs where applicable - Remove TTI hook associated with those passes. - Move tests to UniformityAnalysis folder. - Remove RUN lines for the DA, leave only the UA ones. - Some tests had to be adjusted/removed depending on how they used the legacy DAs. Reviewed By: foad, sameerds Differential Revision: https://reviews.llvm.org/D148116
2023-04-14[Passes] Remove the legacy DemandedBitsWrapperPassBjorn Pettersson1-1/+0
Last user of DemandedBitsWrapperPass was the BDCE pass. Since the legacy PM version of BDCE was removed in an earlier commit, this patch removes the now unused DemandedBitsWrapperPass. Differential Revision: https://reviews.llvm.org/D148336
2023-04-14[llvm-c] Remove PassRegistry and initialization APIsNikita Popov1-9/+0
Remove C APIs for interacting with PassRegistry and pass initialization. These are legacy PM concepts, and are no longer relevant for the new pass manager. Calls to these initialization functions can simply be dropped. Differential Revision: https://reviews.llvm.org/D145043
2022-12-12[AA] Remove CFL AA passesNikita Popov1-2/+0
The CFL Steens/Anders alias analysis passes are not enabled by default, and to the best of my knowledge have no pathway towards ever being enabled by default. The last significant interest in these passes seems to date back to 2016. Given the little maintenance these have seen in recent times, I also have very little confidence in the correctness of these passes. I don't think we should keep these in-tree. Differential Revision: https://reviews.llvm.org/D139703
2022-11-14[AST] Remove legacy AliasSetPrinter passNikita Popov1-1/+0
A NewPM version of this pass exists, drop the legacy version of this testing-only pass.
2022-10-21[ObjCARC] Remove legacy PM versions of optimization passesArthur Eubanks1-1/+0
This doesn't touch objc-arc-contract because that's in the codegen pipeline. However, this does move its corresponding initialize function into initializeCodegen(). Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D135041
2022-05-16[DomPrinter] Migrate -dot-dom to the new pass manager.Yang Keao1-8/+8
In D123677, @YangKeao provided an implementation of `DOTGraphTraits{Viewer,Printer}` in the new pass manager. This commit migrates the `DomPrinter` and `DomViewer` to the new pass manager. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D124904
2021-12-10Reapply CycleInfo: Introduce cycles as a generalization of loopsSameer Sahasrabuddhe1-0/+1
Reverts 02940d6d2202. Fixes breakage in the modules build. LLVM loops cannot represent irreducible structures in the CFG. This change introduce the concept of cycles as a generalization of loops, along with a CycleInfo analysis that discovers a nested hierarchy of such cycles. This is based on Havlak (1997), Nesting of Reducible and Irreducible Loops. The cycle analysis is implemented as a generic template and then instatiated for LLVM IR and Machine IR. The template relies on a new GenericSSAContext template which must be specialized when used for each IR. This review is a restart of an older review request: https://reviews.llvm.org/D83094 Original implementation by Nicolai Hähnle <nicolai.haehnle@amd.com>, with recent refactoring by Sameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com> Differential Revision: https://reviews.llvm.org/D112696
2021-12-07Revert "CycleInfo: Introduce cycles as a generalization of loops"Jonas Devlieghere1-1/+0
This reverts commit 0fe61ecc2cef333250a152cd90d80d0b802b27db because it breaks the modules build. https://green.lab.llvm.org/green/job/clang-stage2-rthinlto/4858/ https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/39112/
2021-12-07CycleInfo: Introduce cycles as a generalization of loopsSameer Sahasrabuddhe1-0/+1
LLVM loops cannot represent irreducible structures in the CFG. This change introduce the concept of cycles as a generalization of loops, along with a CycleInfo analysis that discovers a nested hierarchy of such cycles. This is based on Havlak (1997), Nesting of Reducible and Irreducible Loops. The cycle analysis is implemented as a generic template and then instatiated for LLVM IR and Machine IR. The template relies on a new GenericSSAContext template which must be specialized when used for each IR. This review is a restart of an older review request: https://reviews.llvm.org/D83094 Original implementation by Nicolai Hähnle <nicolai.haehnle@amd.com>, with recent refactoring by Sameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com> Differential Revision: https://reviews.llvm.org/D112696
2020-10-19[NPM] Port module-debuginfo pass to the new pass managerAmy Huang1-1/+1
Port pass to NPM and update tests in DebugInfo/Generic. Differential Revision: https://reviews.llvm.org/D89730
2020-09-24[IRSim] Adding wrapper pass for IRSimilarityIdentfierAndrew Litteken1-0/+1
This introduces an analysis pass that wraps IRSimilarityIdentifier, and adds a printer pass to examine in what function similarities are being found. Test for what the printer pass can find are in test/Analysis/IRSimilarityIdentifier. Reviewed by: paquette, jroelofs Differential Revision: https://reviews.llvm.org/D86973
2020-09-03[NewPM][Lint] Port -lint to NewPMArthur Eubanks1-1/+1
This also changes -lint from an analysis to a pass. It's similar to -verify, and that is a normal pass, and lives in llvm/IR. Reviewed By: ychen Differential Revision: https://reviews.llvm.org/D87057
2020-09-02Revert "[NewPM][Lint] Port -lint to NewPM"Arthur Eubanks1-0/+1
This reverts commit 883399c8402188520870f99e7d8b3244f000e698.
2020-09-02[NewPM][Lint] Port -lint to NewPMArthur Eubanks1-1/+0
This also changes -lint from an analysis to a pass. It's similar to -verify, and that is a normal pass, and lives in llvm/IR. Reviewed By: ychen Differential Revision: https://reviews.llvm.org/D87057
2020-08-21[NFC] Port InstCount pass to new pass managerRoman Lebedev1-1/+1
2019-08-23[MustExec] Add a generic "must-be-executed-context" explorerJohannes Doerfert1-0/+1
Given an instruction I, the MustBeExecutedContextExplorer allows to easily traverse instructions that are guaranteed to be executed whenever I is. For now, these instruction have to be statically "after" I, in the same or different basic blocks. This patch also adds a pass which prints the must-be-executed-context for each instruction in a module. It is used to test the MustBeExecutedContextExplorer, for now on the examples given in the class comment of the MustBeExecutedIterator. Differential Revision: https://reviews.llvm.org/D65186 llvm-svn: 369765
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
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-11-26[stack-safety] Empty local passes for Stack Safety Global AnalysisVitaly Buka1-0/+1
Reviewers: eugenis, vlad.tsyrklevich Subscribers: hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D54541 llvm-svn: 347610
2018-11-26[stack-safety] Empty local passes for Stack Safety Local AnalysisVitaly Buka1-0/+1
Reviewers: eugenis, vlad.tsyrklevich Subscribers: mgorny, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D54502 llvm-svn: 347602
2018-08-30[NFC] Rename the DivergenceAnalysis to LegacyDivergenceAnalysisNicolai Haehnle1-1/+1
Summary: This is patch 1 of the new DivergenceAnalysis (https://reviews.llvm.org/D50433). The purpose of this patch is to free up the name DivergenceAnalysis for the new generic implementation. The generic implementation class will be shared by specialized divergence analysis classes. Patch by: Simon Moll Reviewed By: nhaehnle Subscribers: jvesely, jholewinski, arsenm, nhaehnle, mgorny, jfb, llvm-commits Differential Revision: https://reviews.llvm.org/D50434 Change-Id: Ie8146b11be2c50d5312f30e11c7a3036a15b48cb llvm-svn: 341071
2018-06-28Add a PhiValuesAnalysis pass to calculate the underlying values of phisJohn Brawn1-0/+1
This pass is being added in order to make the information available to BasicAA, which can't do caching of this information itself, but possibly this information may be useful for other passes. Incorporates code based on Daniel Berlin's implementation of Tarjan's algorithm. Differential Revision: https://reviews.llvm.org/D47893 llvm-svn: 335857
2018-03-20Add an analysis printer for must execute reasoningPhilip Reames1-0/+1
Many of our loop passes make use of so called "must execute" or "guaranteed to execute" facts to prove the legality of code motion. The basic notion is that we know (by assumption) an instruction didn't fault at it's original location, so if the location we move it to is strictly post dominated by the original, then we can't have introduced a new fault. At the moment, the testing for this logic is somewhat adhoc and done mostly through LICM. Since I'm working on that code, I want to improve the testing. This patch is the first step in that direction. It doesn't actually test the variant used by the loop passes - I need to move that to the Analysis library first - but instead exercises an alternate implementation used by SCEV. (I plan on merging both implementations.) Note: I'll be replacing the printing logic within this with an annotation based version in the near future. Anna suggested this in review, and it seems like a strictly better format. Differential Revision: https://reviews.llvm.org/D44524 llvm-svn: 328004
2017-04-11MemorySSA: Move to Analysis, from Transforms/Utils. It's used asDaniel Berlin1-0/+2
Analysis, it has Analysis passes, and once NewGVN is made an Analysis, this removes the cross dependency from Analysis to Transform/Utils. NFC. llvm-svn: 299980
2017-03-22[LVI] Add an LVI printer pass to capture test LVI cache after transformationsAnna Thomas1-0/+1
Summary: Adding a printer pass for printing the LVI cache values after transformations that use LVI. This will help us in identifying cases where LVI invariants are violated, or transforms that leave LVI in an incorrect state. Right now, I have added two test cases to show that the printer pass is working. I will be adding more test cases in a later change, once this change is checked in upstream. Reviewers: reames, dberlin, sanjoy, apilipenko Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30790 llvm-svn: 298542
2016-10-28[LCSSA] Perform LCSSA verification only for the current loop nest.Igor Laevsky1-0/+1
Now LPPassManager will run LCSSA verification only for the top-level loop which was processed on the current iteration. Differential Revision: https://reviews.llvm.org/D25873 llvm-svn: 285394
2016-09-15[PM] Port CFGViewer and CFGPrinter to the new Pass ManagerSriraman Tallam1-4/+4
Differential Revision: https://reviews.llvm.org/D24592 llvm-svn: 281640
2016-07-28[BPI] Add new LazyBPI analysisAdam Nemet1-0/+1
Summary: The motivation is the same as in D22141: In order to add the hotness attribute to optimization remarks we need BFI to be available in all passes that emit optimization remarks. BFI depends on BPI so unless we make this lazy as well we would still compute BPI unconditionally. The solution is to use the new LazyBPI pass in LazyBFI and only compute BPI when computation of BFI is requested by the client. I extended the laziness test using a LoopDistribute test to also cover BPI. Reviewers: hfinkel, davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D22835 llvm-svn: 277083
2016-07-18[OptRemarkEmitter] Port to new PMAdam Nemet1-1/+1
Summary: The main goal is to able to start using the new OptRemarkEmitter analysis from the LoopVectorizer. Since the vectorizer was recently converted to the new PM, it makes sense to convert this analysis as well. This pass is currently tested through the LoopDistribution pass, so I am also porting LoopDistribution to get coverage for this analysis with the new PM. Reviewers: davidxl, silvas Subscribers: llvm-commits, mzolotukhin Differential Revision: https://reviews.llvm.org/D22436 llvm-svn: 275810
2016-07-16[PM] Convert IVUsers analysis to new pass manager.Dehao Chen1-1/+1
Summary: Convert IVUsers analysis to new pass manager. Reviewers: davidxl, silvas Subscribers: junbuml, sanjoy, llvm-commits, mzolotukhin Differential Revision: https://reviews.llvm.org/D22434 llvm-svn: 275698
2016-07-15[OptRemark,LDist] RFC: Add hotness attributeAdam Nemet1-0/+1
Summary: This is the first set of changes implementing the RFC from http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334 This is a cross-sectional patch; rather than implementing the hotness attribute for all optimization remarks and all passes in a patch set, it implements it for the 'missed-optimization' remark for Loop Distribution. My goal is to shake out the design issues before scaling it up to other types and passes. Hotness is computed as an integer as the multiplication of the block frequency with the function entry count. It's only printed in opt currently since clang prints the diagnostic fields directly. E.g.: remark: /tmp/t.c:3:3: loop not distributed: use -Rpass-analysis=loop-distribute for more info (hotness: 300) A new API added is similar to emitOptimizationRemarkMissed. The difference is that it additionally takes a code region that the diagnostic corresponds to. From this, hotness is computed using BFI. The new API is exposed via an analysis pass so that it can be made dependent on LazyBFI. (Thanks to Hal for the analysis pass idea.) This feature can all be enabled by setDiagnosticHotnessRequested in the LLVM context. If this is off, LazyBFI is not calculated (D22141) so there should be no overhead. A new command-line option is added to turn this on in opt. My plan is to switch all user of emitOptimizationRemark* to use this module instead. Reviewers: hfinkel Subscribers: rcox2, mzolotukhin, llvm-commits Differential Revision: http://reviews.llvm.org/D21771 llvm-svn: 275583