summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/IPO.cpp
AgeCommit message (Collapse)Author
2024-11-03[IPO] Remove unused includes (NFC) (#114716)Kazu Hirata
Identified with misc-include-cleaner.
2023-04-14[llvm-c] Remove PassRegistry and initialization APIsNikita Popov
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
2023-04-13[Transforms][LTO] Remove some redundant includes. NFCBjorn Pettersson
No need to include CallGraphSCCPass.h from the IPO/Inliner. Also removed the include of LegacyPassManager.h in a couple of files that do not really depend on that header file. Differential Revision: https://reviews.llvm.org/D148083
2023-03-02[llvm-c] Remove bindings for creating legacy passesNikita Popov
Legacy passes are only supported for codegen, and I don't believe it's possible to write backends using the C API, so we should drop all of those. Reduces the number of places that need to be modified when removing legacy passes. Differential Revision: https://reviews.llvm.org/D144970
2023-02-27[IPO] Remove various legacy passesArthur Eubanks
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated and being removed.
2023-02-14[IPSCCP] Remove legacy passArthur Eubanks
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-14[GlobalOpt] Remove legacy passArthur Eubanks
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-10[Passes] Remove some legacy passesArthur Eubanks
Namely CrossDSOCFI and GlobalSplit. These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-09[Inliner] Remove legacy simple inlinerArthur Eubanks
It's part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-07[RPOFunctionAttrs] Use LazyCallGraph instead of CallGraphSamuel
There are a few more uses of CallGraph that should be replaced with LazyCallGraph Also delete legacy version of RPOFunctionAttrs since it is deprecated and LazyCallGraph is not available under the legacy pass manager. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D143358
2023-02-07Reland [LegacyPM] Remove some legacy passesArthur Eubanks
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated. Namely * Internalize * StripSymbols * StripNonDebugSymbols * StripDeadDebugInfo * StripDeadPrototypes * VectorCombine * WarnMissedTransformations Fixed previously failing ocaml tests (one of them seems to already be failing?)
2023-02-07Revert "[LegacyPM] Remove some legacy passes"Arthur Eubanks
This reverts commit a4b4f62beb0bf40123181e5f5bdf32ef54f87166. Ocaml bindings tests failing.
2023-02-07[LegacyPM] Remove some legacy passesArthur Eubanks
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated. Namely * Internalize * StripSymbols * StripNonDebugSymbols * StripDeadDebugInfo * StripDeadPrototypes * VectorCombine * WarnMissedTransformations
2023-02-06[IPO] Remove some legacy passesArthur Eubanks
These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.
2023-02-06[MergeFunctions] Remove legacy passArthur Eubanks
It's part of the optimization pipeline, which the legacy pass manager version is deprecated.
2022-12-20[llvm-extract] Use new pass manager instead of legacy pass managerArthur Eubanks
Removes some legacy passes specific to llvm-extract
2022-12-10[FuncSpec] Make the Function Specializer part of the IPSCCP pass.Alexandros Lamprineas
Reland 877a9f9abec61f06e39f1cd872e37b828139c2d1 since D138654 (parent) has been fixed with 9ebaf4fef4aac89d4eff08e48185d61bc893f14e and with 8f1e11c5a7d70f96943a72649daa69f152d73e90. Differential Revision: https://reviews.llvm.org/D126455
2022-12-08Revert "[FuncSpec] Make the Function Specializer part of the IPSCCP pass."Alexandros Lamprineas
This reverts commit 877a9f9abec61f06e39f1cd872e37b828139c2d1. It depends on the parent revision 42c2dc401742266da3e0251b6c1ca491f4779963 which needs to be reverted as it broke some buildbots, so reverting both.
2022-12-08[FuncSpec] Make the Function Specializer part of the IPSCCP pass.Alexandros Lamprineas
The aim of this patch is to minimize the compilation time overhead of running Function Specialization. It is about 40% slower to run as a standalone pass (IPSCCP + FuncSpec vs IPSCCP with FuncSpec) according to my measurements. I compiled the llvm testsuite with NewPM-O3 + LTO and measured single threaded [user + system] time of IPSCCP and FuncSpec by passing the '-time-passes' option to lld. Then I compared the two configurations in terms of Instruction Count of the total compilation (not of the individual passes) as in https://llvm-compile-time-tracker.com. Geomean for non-LTO builds is -0.25% and LTO is -0.5% approximately. You can find more info below: https://discourse.llvm.org/t/rfc-should-we-enable-function-specialization/61518 Differential Revision: https://reviews.llvm.org/D126455
2022-12-01[OpenMP][LegacyPM] Remove OpenMPOptCGSCCLegacyPassLiaoChunyu
Using the legacy pass manager for the optimization pipeline is deprecated. I see the new PM is available. Reviewed By: aeubanks, jdoerfert Differential Revision: https://reviews.llvm.org/D139004
2022-09-26[NFC][2/n] Remove PrunePH passSebastian Peryt
Second patch in the series to remove legacy PM and associated -enable-new-pm=0 flag targets pass that has not been ported to new PM - PruneEH. Discussion about this can be found in D44415. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D134686
2022-07-17[LegacyPM] Remove WholeProgramDevirtFangrui Song
Unused after LTO removal from legacy optimization passline.
2022-07-17[LegacyPM] Remove FunctionImportLegacyPassFangrui Song
Unused after ThinLTO was removed from legacy optimization pipeline.
2022-07-17[LegacyPM] Remove LowerTypeTestsPassFangrui Song
Unused after LTO removal from optimization passline.
2022-07-17[LegacyPM] Remove SampleProfileLoaderLegacyPassFangrui Song
Following recent changes removing non-core features of the legacy PM/optimization pipeline (e.g. PGO), remove SamplePGO.
2022-06-27[ArgPromotion] Remove legacy PM supportNikita Popov
Support for the legacy pass manager in ArgPromotion causes complications in D125485. As the legacy pass manager for middle-end optimizations is unsupported, drop ArgPromotion from the legacy pipeline, rather than introducing additional complexity to deal with it. Differential Revision: https://reviews.llvm.org/D128536
2021-06-11Function Specialization PassSjoerd Meijer
This adds a function specialization pass to LLVM. Constant parameters like function pointers and constant globals are propagated to the callee by specializing the function. This is a first version with a number of limitations: - The pass is off by default, so needs to be enabled on the command line, - It does not handle specialization of recursive functions, - It does not yet handle constants and constant ranges, - Only 1 argument per function is specialised, - The cost-model could be further looked into, and perhaps related, - We are not yet caching analysis results. This is based on earlier work by Matthew Simpson (D36432) and Vinay Madhusudan. More recently this was also discussed on the list, see: https://lists.llvm.org/pipermail/llvm-dev/2021-March/149380.html. The motivation for this work is that function specialisation often comes up as a reason for performance differences of generated code between LLVM and GCC, which has this enabled by default from optimisation level -O3 and up. And while this certainly helps a few cpu benchmark cases, this also triggers in real world codes and is thus a generally useful transformation to have in LLVM. Function specialisation has great potential to increase compile-times and code-size. The summary from some investigations with this patch is: - Compile-time increases for short compile jobs is high relatively, but the increase in absolute numbers still low. - For longer compile-jobs, the extra compile time is around 1%, and very much in line with GCC. - It is difficult to blame one thing for compile-time increases: it looks like everywhere a little bit more time is spent processing more functions and instructions. - But the function specialisation pass itself is not very expensive; it doesn't show up very high in the profile of the optimisation passes. The goal of this work is to reach parity with GCC which means that eventually we would like to get this enabled by default. But first we would like to address some of the limitations before that. Differential Revision: https://reviews.llvm.org/D93838
2021-04-20[OpenMP] Add OpenMPOpt as a Module passJoseph Huber
Summary: This patch registers OpenMPOpt as a Module pass in addition to a CGSCC pass. This is so certain optimzations that are sensitive to intact call-sites can happen before inlining. The old `openmpopt` pass name is changed to `openmp-opt-cgscc` and `openmp-opt` calls the Module pass. The current module pass only runs a single check but will be expanded in the future. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D99202
2020-12-17[IRSim][IROutliner] Adding the extraction basics for the IROutliner.Andrew Litteken
Extracting the similar regions is the first step in the IROutliner. Using the IRSimilarityIdentifier, we collect the SimilarityGroups and sort them by how many instructions will be removed. Each IRSimilarityCandidate is used to define an OutlinableRegion. Each region is ordered by their occurrence in the Module and the regions that are not compatible with previously outlined regions are discarded. Each region is then extracted with the CodeExtractor into its own function. We test that correctly extract in: test/Transforms/IROutliner/extraction.ll test/Transforms/IROutliner/address-taken.ll test/Transforms/IROutliner/outlining-same-globals.ll test/Transforms/IROutliner/outlining-same-constants.ll test/Transforms/IROutliner/outlining-different-structure.ll Recommit of bf899e891387d07dfd12de195ce2a16f62afd5e0 fixing memory leaks. Reviewers: paquette, jroelofs, yroux Differential Revision: https://reviews.llvm.org/D86975
2020-11-27Revert "[IRSim][IROutliner] Adding the extraction basics for the IROutliner."Andrew Litteken
Reverting commit due to address sanitizer errors. > Extracting the similar regions is the first step in the IROutliner. > > Using the IRSimilarityIdentifier, we collect the SimilarityGroups and > sort them by how many instructions will be removed. Each > IRSimilarityCandidate is used to define an OutlinableRegion. Each > region is ordered by their occurrence in the Module and the regions that > are not compatible with previously outlined regions are discarded. > > Each region is then extracted with the CodeExtractor into its own > function. > > We test that correctly extract in: > test/Transforms/IROutliner/extraction.ll > test/Transforms/IROutliner/address-taken.ll > test/Transforms/IROutliner/outlining-same-globals.ll > test/Transforms/IROutliner/outlining-same-constants.ll > test/Transforms/IROutliner/outlining-different-structure.ll > > Reviewers: paquette, jroelofs, yroux > > Differential Revision: https://reviews.llvm.org/D86975 This reverts commit bf899e891387d07dfd12de195ce2a16f62afd5e0.
2020-11-27[IRSim][IROutliner] Adding the extraction basics for the IROutliner.Andrew Litteken
Extracting the similar regions is the first step in the IROutliner. Using the IRSimilarityIdentifier, we collect the SimilarityGroups and sort them by how many instructions will be removed. Each IRSimilarityCandidate is used to define an OutlinableRegion. Each region is ordered by their occurrence in the Module and the regions that are not compatible with previously outlined regions are discarded. Each region is then extracted with the CodeExtractor into its own function. We test that correctly extract in: test/Transforms/IROutliner/extraction.ll test/Transforms/IROutliner/address-taken.ll test/Transforms/IROutliner/outlining-same-globals.ll test/Transforms/IROutliner/outlining-same-constants.ll test/Transforms/IROutliner/outlining-different-structure.ll Reviewers: paquette, jroelofs, yroux Differential Revision: https://reviews.llvm.org/D86975
2020-11-16Add pass to add !annotate metadata from @llvm.global.annotations.Florian Hahn
This patch adds a new pass to add !annotation metadata for entries in @llvm.global.anotations, which is generated using __attribute__((annotate("_name"))) on functions in Clang. This has been discussed on llvm-dev as part of RFC: Combining Annotation Metadata and Remarks http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html Reviewed By: thegameg Differential Revision: https://reviews.llvm.org/D91195
2020-10-21[BlockExtract][NewPM] Port -extract-blocks to NPMArthur Eubanks
Reviewed By: thakis Differential Revision: https://reviews.llvm.org/D89015
2020-10-13[LoopExtract][NewPM] Port -loop-extract to NPMArthur Eubanks
-loop-extract-single is just -loop-extract on one loop. -loop-extract depended on -break-crit-edges and -loop-simplify in the legacy PM, but the NPM doesn't allow specifying pass dependencies like that, so manually add those passes to the RUN lines where necessary. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D89016
2020-08-02Recommit "[IPConstProp] Remove and move tests to SCCP."Florian Hahn
This reverts commit 59d6e814ce0e7b40b7cc3ab136b9af2ffab9c6f8. The cause for the revert (3 clang tests running opt -ipconstprop) was fixed by removing those lines.
2020-07-30Revert "[IPConstProp] Remove and move tests to SCCP."Florian Hahn
This reverts commit e77624a3be942c7abba48942b3a8da3462070a3f. Looks like some clang tests manually invoke -ipconstprop via opt.....
2020-07-30[IPConstProp] Remove and move tests to SCCP.Florian Hahn
As far as I know, ipconstprop has not been used in years and ipsccp has been used instead. This has the potential for confusion and sometimes leads people to spend time finding & reporting bugs as well as updating it to work with the latest API changes. This patch moves the tests over to SCCP. There's one functional difference I am aware of: ipconstprop propagates for each call-site individually, so for functions that are called with different constant arguments it can sometimes produce better results than ipsccp (at much higher compile-time cost).But IPSCCP can be thought to do so as well for internal functions and as mentioned earlier, the pass seems unused in practice (and there are no plans on working towards enabling it anytime). Also discussed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2020-July/143773.html Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D84447
2020-02-08[Attributor] Add an Attributor CGSCC pass and run itJohannes Doerfert
In addition to the module pass, this patch introduces a CGSCC pass that runs the Attributor on a strongly connected component of the call graph (both old and new PM). The Attributor was always design to be used on a subset of functions which makes this patch mostly mechanical. The one change is that we give up `norecurse` deduction in the module pass in favor of doing it during the CGSCC pass. This makes the interfaces simpler but can be revisited if needed. Reviewed By: hfinkel Differential Revision: https://reviews.llvm.org/D70767
2020-02-08[OpenMP] Introduce the OpenMPOpt transformation passJohannes Doerfert
The OpenMPOpt pass is a CGSCC pass in which OpenMP specific optimizations can reside. The OpenMPOpt pass uses the OpenMPKinds.def file to identify runtime calls and their uses. This allows targeted transformations and eases their implementation. This initial patch deduplicates `__kmpc_global_thread_num` and `omp_get_thread_num` calls. We can also identify arguments that are equivalent to such a call result and use it instead. Later we can determine "gtid" arguments based on the use in kernel functions etc. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D69930
2020-01-14[NewPM] Port MergeFunctions passNikita Popov
This ports the MergeFunctions pass to the NewPM. This was rather straightforward, as no analyses are used. Additionally MergeFunctions needs to be conditionally enabled in the PassBuilder, but I left that part out of this patch. Differential Revision: https://reviews.llvm.org/D72537
2019-09-29[LLVM-C][Ocaml] Add MergeFunctions and DCE passAditya Kumar
MergeFunctions and DCE pass are missing from OCaml/C-api. This patch adds them. Differential Revision: https://reviews.llvm.org/D65071 Reviewers: whitequark, hiraditya, deadalnix Reviewed By: whitequark Subscribers: llvm-commits Tags: #llvm Authored by: kren1 llvm-svn: 373170
2019-07-23[LLVM-C] Improve Bindings to The Internalize PassRobert Widmann
Summary: Adds a binding to the internalize pass that allows the caller to pass a function pointer that acts as the visibility-preservation predicate. Previously, one could only pass an unsigned value (not LLVMBool?) that directed the pass to consider "main" or not. Reviewers: whitequark, deadalnix, harlanhaskins Reviewed By: whitequark, harlanhaskins Subscribers: kren1, hiraditya, llvm-commits, harlanhaskins Tags: #llvm Differential Revision: https://reviews.llvm.org/D62456 llvm-svn: 366777
2019-06-05[Attributor] Pass infrastructure and fixpoint frameworkJohannes Doerfert
NOTE: Note that no attributes are derived yet. This patch will not go in alone but only with others that derive attributes. The framework is split for review purposes. This commit introduces the Attributor pass infrastructure and fixpoint iteration framework. Further patches will introduce abstract attributes into this framework. In a nutshell, the Attributor will update instances of abstract arguments until a fixpoint, or a "timeout", is reached. Communication between the Attributor and the abstract attributes that are derived is restricted to the AbstractState and AbstractAttribute interfaces. Please see the file comment in Attributor.h for detailed information including design decisions and typical use case. Also consider the class documentation for Attributor, AbstractState, and AbstractAttribute. Reviewers: chandlerc, homerdin, hfinkel, fedor.sergeev, sanjoy, spatel, nlopes, nicholas, reames Subscribers: mehdi_amini, mgorny, hiraditya, bollu, steven_wu, dexonsmith, dang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59918 llvm-svn: 362578
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-09-07Hot cold splitting passAditya Kumar
Find cold blocks based on profile information (or optionally with static analysis). Forward propagate profile information to all cold-blocks. Outline a cold region. Set calling conv and prof hint for the callsite of the outlined function. Worked in collaboration with: Sebastian Pop <s.pop@samsung.com> Differential Revision: https://reviews.llvm.org/D50658 llvm-svn: 341669
2018-03-28Transforms: Introduce Transforms/Utils.h rather than spreading the ↵David Blaikie
declarations amongst Scalar.h and IPO.h Fixes layering - Transforms/Utils shouldn't depend on including a Scalar or IPO header, because Scalar and IPO depend on Utils. llvm-svn: 328717
2018-03-22Finish moving the IPSCCP pass from Scalar to IPO - moving the registrationDavid Blaikie
llvm-svn: 328259
2018-03-22Move the initialization of the Meta Renamer pass over to IPO along with the ↵David Blaikie
rest of it that was moved in r328209 llvm-svn: 328234
2018-01-23[llvm-extract] Support extracting basic blocksVolkan Keles
Summary: Currently, there is no way to extract a basic block from a function easily. This patch extends llvm-extract to extract the specified basic block(s). Reviewers: loladiro, rafael, bogner Reviewed By: bogner Subscribers: hintonda, mgorny, qcolombet, llvm-commits Differential Revision: https://reviews.llvm.org/D41638 llvm-svn: 323266
2017-10-25Add CalledValuePropagation passMatthew Simpson
This patch adds a new pass for attaching !callees metadata to indirect call sites. The pass propagates values to call sites by performing an IPSCCP-like analysis using the generic sparse propagation solver. For indirect call sites having a small set of possible callees, the attached metadata indicates what those callees are. The metadata can be used to facilitate optimizations like intersecting the function attributes of the possible callees, refining the call graph, performing indirect call promotion, etc. Differential Revision: https://reviews.llvm.org/D37355 llvm-svn: 316576