aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CallGraphSCCPass.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-05-23[Analysis] Remove unused includes (NFC) (#141319)Kazu Hirata1-1/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-02-18[Analysis] Remove skipSCC (#127412)Kazu Hirata1-22/+0
The last use was removed in: commit fa6ea7a419f37befbed04368bcb8af4c718facbb Author: Arthur Eubanks <aeubanks@google.com> Date: Mon Mar 20 11:18:35 2023 -0700
2024-09-20[llvm] Don't call raw_string_ostream::flush() (NFC)Youngsuk Kim1-1/+0
Don't call raw_string_ostream::flush(), which is essentially a no-op. As specified in the docs, raw_string_ostream is always unbuffered. ( 65b13610a5226b84889b923bae884ba395ad084d for further reference )
2024-06-21[llvm] format and terminate namespaces with closing comment (#94917)Mohammed Keyvanzadeh1-1/+1
Namespaces are terminated with a closing comment in the majority of the codebase so do the same here for consistency. Also format code within some namespaces to make clang-format happy.
2023-06-25[llvm] Add missing StringExtras.h includesElliot Goodrich1-0/+1
In preparation for removing the `#include "llvm/ADT/StringExtras.h"` from the header to source file of `llvm/Support/Error.h`, first add in all the missing includes that were previously included transitively through this header.
2023-01-10[CallGraph][FIX] Ensure generic intrinsics are represented in the CGJohannes Doerfert1-9/+1
Intrinsics have historically been excluded from the call graph with an exception of 3 special ones added at some point. This meant that passes depending on the call graph needed to handle intrinsics explicitly as the underlying assumption, namely that intrinsics can't call or modify things, doesn't hold. We are slowly moving away from special handling of intrinsics, or at least towards explicitly checking what intrinsics we want to handle differently. This patch: - Includes most intrinsics in the call graph. Debug intrinsics are still excluded. - Removes the special handling of intrinsics in the GlobalsAA pass. - Removes the `IntrinsicInst::isLeaf` method. Properly Fixes: https://github.com/llvm/llvm-project/issues/52706 See also: https://discourse.llvm.org/t/intrinsics-are-not-special-stop-pretending-i-mean-it/67545 Differential Revision: https://reviews.llvm.org/D14119
2022-11-25Use PassGate from LLVMContext if any otherwise global oneEvgeniy Brevnov1-1/+2
Differential Revision: https://reviews.llvm.org/D137149
2022-04-25[NFC] Rename Instrinsic to IntrinsicDavid Green1-1/+1
2022-03-17[LegacyPassManager] Move structural hashing into Pass classes. NFC.Jay Foad1-5/+2
Move structural hashing into virtual methods on Pass. This will allow MachineFunctionPass to override the method to add hashing of the MachineFunction. Differential Revision: https://reviews.llvm.org/D120123
2022-03-12Cleanup includes: DebugInfo & CodeGenserge-sans-paille1-0/+2
Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D121332
2022-03-01Cleanup includes: TransformsUtilsserge-sans-paille1-1/+0
Estimation on the impact on preprocessor output: before: 1065307662 after: 1064800684 Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D120741
2022-03-01Cleanup includes: LLVMAnalysisserge-sans-paille1-0/+1
Number of lines output by preprocessor: before: 1065940348 after: 1065307662 Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D120659
2022-01-07[llvm] Remove redundant member initialization (NFC)Kazu Hirata1-1/+1
Identified with readability-redundant-member-init.
2022-01-03Revert "[llvm] Remove redundant member initialization (NFC)"Kazu Hirata1-1/+1
This reverts commit fd4808887ee47f3ec8a030e9211169ef4fb094c3. This patch causes gcc to issue a lot of warnings like: warning: base class ‘class llvm::MCParsedAsmOperand’ should be explicitly initialized in the copy constructor [-Wextra]
2022-01-01[llvm] Remove redundant member initialization (NFC)Kazu Hirata1-1/+1
Identified with readability-redundant-member-init.
2021-05-07Internalize some cl::opt global variables or move them under namespace llvmFangrui Song1-0/+2
2021-02-22[Analysis] Use ListSeparator (NFC)Kazu Hirata1-9/+6
2020-12-03[NewPM] Support --print-before/after in NPMArthur Eubanks1-1/+1
This changes --print-before/after to be a list of strings rather than legacy passes. (this also has the effect of not showing the entire list of passes in --help-hidden after --print-before/after, which IMO is great for making it less verbose). Currently PrintIRInstrumentation passes the class name rather than pass name to llvm::shouldPrintBeforePass(), meaning llvm::shouldPrintBeforePass() never functions as intended in the NPM. There is no easy way of converting class names to pass names outside of within an instance of PassBuilder. This adds a map of pass class names to their short names in PassRegistry.def within PassInstrumentationCallbacks. It is populated inside the constructor of PassBuilder, which takes a PassInstrumentationCallbacks. Add a pointer to PassInstrumentationCallbacks inside PrintIRInstrumentation and use the newly created map. This is a bit hacky, but I can't think of a better way since the short id to class name only exists within PassRegistry.def. This also doesn't handle passes not in PassRegistry.def but rather added via PassBuilder::registerPipelineParsingCallback(). llvm/test/CodeGen/Generic/print-after.ll doesn't seem very useful now with this change. Reviewed By: ychen, jamieschmeiser Differential Revision: https://reviews.llvm.org/D87216
2020-11-23[NPM] Share pass building options with legacy PMArthur Eubanks1-4/+4
We should share options when possible. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D91741
2020-08-28Skip analysis re-computation when no changes are reportedserge-sans-paille1-1/+2
This is a follow-up to https://reviews.llvm.org/D80707, generalized to CallGraphSCC, Loop and Region Differential Revision: https://reviews.llvm.org/D86442
2020-08-28(Expensive) Check for Loop, SCC and Region pass return statusserge-sans-paille1-3/+17
This generalizes the logic introduced in https://reviews.llvm.org/D80916 to other passes. It's needed by https://reviews.llvm.org/D86442 to assert passes correctly report their status. Differential Revision: https://reviews.llvm.org/D86589
2020-07-14[CallGraph] Update callback call sites in RefreshCallGraphJohannes Doerfert1-13/+38
Since D82572, we keep "reference" edges for callback call sites. While not strictly necessary they can improve the traversal order. However, we did not update them properly in case a pass removed the callback call site which caused a verification error (PR46687). With this patch we update these reference edges properly during the invocation of `CallGraphSCCPass::RefreshCallGraph` in non-checking mode. Reviewed By: sdmitriev Differential Revision: https://reviews.llvm.org/D83718
2020-07-01[CallGraph] Add support for callback call sitesSergey Dmitriev1-1/+7
Summary: This patch changes call graph analysis to recognize callback call sites and add an artificial 'reference' call record from the broker function caller to the callback function in the call graph. A presence of such reference enforces bottom-up traversal order for callback functions in CG SCC pass manager because callback function logically becomes a callee of the broker function caller. Reviewers: jdoerfert, hfinkel, sstefan1, baziotis Reviewed By: jdoerfert Subscribers: hiraditya, kuter, sstefan1, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D82572
2020-06-28[NFC] CallGraph related cleanupSergey Dmitriev1-6/+4
Summary: Tidy up some CallGraph-related code in preparation for D82572. Reviewers: jdoerfert Reviewed By: jdoerfert Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D82686
2020-04-15[CallGraphUpdater][NFC] Minor updates to D77855Johannes Doerfert1-1/+1
I uploaded the old version accidentally instead of the one with these minor adjustments requested by the reviewers. Differential Revision: https://reviews.llvm.org/D77855
2020-04-15[CallGraphUpdater] Remove nodes from their SCC (old PM)Johannes Doerfert1-0/+4
Summary: We can and should remove deleted nodes from their respective SCCs. We did not do this before and this was a potential problem even though I couldn't locally trigger an issue. Since the `DeleteNode` would assert if the node was not in the SCC, we know we only remove nodes from their SCC and only once (when run on all the Attributor tests). Reviewers: lebedev.ri, hfinkel, fhahn, probinson, wristow, loladiro, sstefan1, uenoku Subscribers: hiraditya, bollu, uenoku, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77855
2020-02-08Introduce a CallGraph updater helper classJohannes Doerfert1-1/+4
The CallGraphUpdater is a helper that simplifies the process of updating the call graph, both old and new style, while running an CGSCC pass. The uses are contained in different commits, e.g. D70767. More functionality is added as we need it. Reviewed By: modocache, hfinkel Differential Revision: https://reviews.llvm.org/D70927
2019-04-19[CallSite removal] Move the legacy PM, call graph, and some inlinerChandler Carruth1-31/+31
code to `CallBase`. This patch focuses on the legacy PM, call graph, and some of inliner and legacy passes interacting with those APIs from `CallSite` to the new `CallBase` class. No interesting changes. Differential Revision: https://reviews.llvm.org/D60412 llvm-svn: 358739
2019-02-28Fix IR/Analysis layering issue with OptBisectRichard Trieu1-4/+21
OptBisect is in IR due to LLVMContext using it. However, it uses IR units from Analysis as well. This change moves getDescription functions from OptBisect to their respective IR units. Generating names for IR units will now be up to the callers, keeping the Analysis IR units in Analysis. To prevent unnecessary string generation, isEnabled function is added so that callers know when the description needs to be generated. Differential Revision: https://reviews.llvm.org/D58406 llvm-svn: 355068
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-12-03Fixing -print-module-scope for legacy SCC passesFedor Sergeev1-4/+21
It appears that print-module-scope was not implemented for legacy SCC passes. Fixed to print a whole module instead of just current SCC. Reviewed By: mkazantsev Differential Revision: https://reviews.llvm.org/D54793 llvm-svn: 348144
2018-09-24[New PM][PassInstrumentation] IR printing support for New Pass ManagerFedor Sergeev1-0/+1
Implementing -print-before-all/-print-after-all/-filter-print-func support through PassInstrumentation callbacks. - PrintIR routines implement printing callbacks. - StandardInstrumentations class provides a central place to manage all the "standard" in-tree pass instrumentations. Currently it registers PrintIR callbacks. Reviewers: chandlerc, paquette, philip.pfaffe Differential Revision: https://reviews.llvm.org/D50923 llvm-svn: 342896
2018-09-06Output per-function size-info remarksJessica Paquette1-2/+4
This patch adds per-function size information remarks. Previously, passing -Rpass-analysis=size-info would only give you per-module changes. By adding the ability to do this per-function, it's easier to see which functions contributed the most to size changes. https://reviews.llvm.org/D51467 llvm-svn: 341588
2018-08-31[NFC] Pass the instruction delta to emitInstrCountChangedRemarkJessica Paquette1-4/+4
Instead of counting the size of the entire module every time we run a pass, pass along a delta instead and use that to emit the remark. This means we only have to use (on average) smaller IR units to calculate instruction counts. E.g, in a BB pass, we only need to look at the delta of the BB instead of the delta of the entire module. 6/6 (This improved compile time for size remarks on sqlite3 + O2 significantly) llvm-svn: 341250
2018-08-31[NFC] Pre-calculate SCC IR counts in size remarks.Jessica Paquette1-5/+13
Same vein as the previous commits. Pre-calculate the size of the module and use that to decide if we're going to emit a remark. This one comes with a FIXME and TODO. First off, CallGraphSCC and CallGraphNode don't have a getInstructionCount function. So, for now, we do the same thing as in a module pass. Second off, we're not really saving anything here yet, because as before, I need to change emitInstrCountChangedRemark to take in a delta. Keeping the patches small though, so that's coming up next. 5/6 llvm-svn: 341249
2018-08-28[NFC][PassTiming] factor out generic PassTimingInfoFedor Sergeev1-0/+1
Moving PassTimingInfo from legacy pass manager code into a separate header. Making it suitable for both legacy and new pass manager. Adding a test on -time-passes main functionality. llvm-svn: 340872
2018-07-30Remove trailing spaceFangrui Song1-49/+49
sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h} llvm-svn: 338293
2018-07-22[ORE] Move loop invariant ORE checks outside the PM loop.Xin Tong1-2/+6
Summary: This takes 22ms out of ~20s compiling sqlite3.c because we call it for every unit of compilation and every pass. Reviewers: paquette, anemet Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D49586 llvm-svn: 337654
2018-07-13Revert "CallGraphSCCPass: iterate over all functions."Evgeniy Stepanov1-71/+39
This reverts commit r336419: use-after-free on CallGraph::FunctionMap elements due to the use of a stale iterator in CGPassManager::runOnModule. The iterator may be invalidated if a pass removes a function, ex.: llvm::LegacyInlinerBase::inlineCalls inlineCallsImpl llvm::CallGraph::removeFunctionFromModule llvm-svn: 337018
2018-07-06CallGraphSCCPass: iterate over all functions.Tim Northover1-39/+71
Previously we only iterated over functions reachable from the set of external functions in the module. But since some of the passes under this (notably the always-inliner and coroutine lowerer) are required for correctness, they need to run over everything. This just adds an extra layer of iteration over the CallGraph to keep track of which functions we've already visited and get the next batch of SCCs. Should fix PR38029. llvm-svn: 336419
2018-05-18Add remarks describing when a pass changes the IR instruction count of a moduleJessica Paquette1-0/+6
This patch adds a remark which tells the user when a pass changes the number of IR instructions in a module. It can be enabled by using -Rpass-analysis=size-info. The point of this is to make it easier to collect statistics on how passes modify programs in terms of code size. This is similar in concept to timing reports, but using a remark-based interface makes it easy to diff changes over multiple compilations of the same program. By adding functionality like this, we can see * Which passes impact code size the most * How passes impact code size at different optimization levels * Which pass might have contributed the most to an overall code size regression The patch lives in the legacy pass manager, but since it's simply emitting remarks, it shouldn't be too difficult to adapt the functionality to the new pass manager as well. This can also be adapted to handle MachineInstr counts in code gen passes. https://reviews.llvm.org/D38768 llvm-svn: 332739
2018-05-14Rename DEBUG macro to LLVM_DEBUG.Nicola Zaghen1-26/+24
The DEBUG() macro is very generic so it might clash with other projects. The renaming was done as follows: - git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g' - git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM - Manual change to APInt - Manually chage DOCS as regex doesn't match it. In the transition period the DEBUG() macro is still present and aliased to the LLVM_DEBUG() one. Differential Revision: https://reviews.llvm.org/D43624 llvm-svn: 332240
2018-03-27[NFC] OptPassGate extracted from OptBisectFedor Sergeev1-1/+1
Summary: This is an NFC refactoring of the OptBisect class to split it into an optional pass gate interface used by LLVMContext and the Optional Pass Bisector (OptBisect) used for debugging of optional passes. This refactoring is needed for D44464, which introduces setOptPassGate() method to allow implementations other than OptBisect. Patch by Yevgeny Rouban. Reviewers: andrew.w.kaylor, fedor.sergeev, vsk, dberlin, Eugene.Zelenko, reames, skatkov Reviewed By: fedor.sergeev Differential Revision: https://reviews.llvm.org/D44821 llvm-svn: 328637
2017-08-31[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use ↵Eugene Zelenko1-19/+24
warnings; other minor fixes. Also affected in files (NFC). llvm-svn: 312289
2017-06-12Address http://bugs.llvm.org/pr32207 by making BannerPrinted local to ↵Yaron Keren1-4/+4
runOnSCC and skipping banner for function declarations. Reviewed By: Mehdi AMINI Differential Revision: https://reviews.llvm.org/D34086 llvm-svn: 305179
2017-05-18[Statistics] Add a method to atomically update a statistic that contains a ↵Craig Topper1-4/+2
maximum Summary: There are several places in the codebase that try to calculate a maximum value in a Statistic object. We currently do this in one of two ways: MaxNumFoo = std::max(MaxNumFoo, NumFoo); or MaxNumFoo = (MaxNumFoo > NumFoo) ? MaxNumFoo : NumFoo; The first version reads from MaxNumFoo one time and uncontionally rwrites to it. The second version possibly reads it twice depending on the result of the first compare. But we have no way of knowing if the value was changed by another thread between the reads and the writes. This patch adds a method to the Statistic object that can ensure that we only store if our value is the max and the previous max didn't change after we read it. If it changed we'll recheck if our value should still be the max or not and try again. This spawned from an audit I'm trying to do of all places we uses the implicit conversion to unsigned on the Statistics objects. See my previous thread on llvm-dev https://groups.google.com/forum/#!topic/llvm-dev/yfvxiorKrDQ Reviewers: dberlin, chandlerc, hfinkel, dblaikie Reviewed By: chandlerc Subscribers: llvm-commits, sanjoy Differential Revision: https://reviews.llvm.org/D33301 llvm-svn: 303318
2017-05-01Rename WeakVH to WeakTrackingVH; NFCSanjoy Das1-2/+3
This relands r301424. llvm-svn: 301812
2017-04-26Reverts commit r301424, r301425 and r301426Sanjoy Das1-4/+4
Commits were: "Use WeakVH instead of WeakTrackingVH in AliasSetTracker's UnkownInsts" "Add a new WeakVH value handle; NFC" "Rename WeakVH to WeakTrackingVH; NFC" The changes assumed pointers are 8 byte aligned on all architectures. llvm-svn: 301429
2017-04-26Rename WeakVH to WeakTrackingVH; NFCSanjoy Das1-4/+4
Summary: I plan to use WeakVH to mean "nulls itself out on deletion, but does not track RAUW" in a subsequent commit. Reviewers: dblaikie, davide Reviewed By: davide Subscribers: arsenm, mehdi_amini, mcrosier, mzolotukhin, jfb, llvm-commits, nhaehnle Differential Revision: https://reviews.llvm.org/D32266 llvm-svn: 301424
2017-03-10Implement getPassName() for IR printing passes.Yaron Keren1-0/+2
llvm-svn: 297442