aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Analysis/CallGraph.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-03-31[MLIR][NFC] Fix incomplete boundary comments. (#133516)Han-Chung Wang1-0/+1
I observed that we have the boundary comments in the codebase like: ``` //===----------------------------------------------------------------------===// // ... //===----------------------------------------------------------------------===// ``` I also observed that there are incomplete boundary comments. The revision is generated by a script that completes the boundary comments. ``` //===----------------------------------------------------------------------===// // ... ... ``` Signed-off-by: hanhanW <hanhan0912@gmail.com>
2024-09-10Reland [MLIR] Make resolveCallable customizable in CallOpInterface (#107989)Henrich Lauko1-1/+1
Relands #100361 with fixed dependencies.
2024-09-10Revert "[MLIR] Make `resolveCallable` customizable in `CallOpInterface`" ↵Matthias Springer1-1/+1
(#107984) Reverts llvm/llvm-project#100361 This commit caused some linker errors. (Missing `MLIRCallInterfaces` dependency.)
2024-09-10[MLIR] Make `resolveCallable` customizable in `CallOpInterface` (#100361)Henrich Lauko1-1/+1
Allow customization of the `resolveCallable` method in the `CallOpInterface`. This change allows for operations implementing this interface to provide their own logic for resolving callables. - Introduce the `resolveCallable` method, which does not include the optional symbol table parameter. This method replaces the previously existing extra class declaration `resolveCallable`. - Introduce the `resolveCallableInTable` method, which incorporates the symbol table parameter. This method replaces the previous extra class declaration `resolveCallable` that used the optional symbol table parameter.
2023-10-26Apply clang-tidy fixes for misc-include-cleaner in CallGraph.cpp (NFC)Mehdi Amini1-1/+5
2023-10-21Apply clang-tidy fixes for llvm-qualified-auto in CallGraph.cpp (NFC)Mehdi Amini1-1/+1
2022-09-09[mlir][CallGraph] Add special call graph node for representing unknown calleesMarkus Böck1-7/+12
The callgraph currently contains a special external node that is used both as the quasi caller for any externally callable as well as callees that could not be resolved. This has one negative side effect however, which is the motivation for this patch: It leads to every externally callable which contains a call that could not be resolved (eg. an indirect call), to be put into one giant SCC when iterating over the SCCs of the call graph. This patch fixes that issue by creating a second special callgraph node that acts as the callee for any unresolved callable. This breaks the cycles produced in the callgraph, yielding proper SCCs for all direct calls. Differential Revision: https://reviews.llvm.org/D133585
2020-10-16[mlir] Update SCCP and the Inliner to use SymbolTableCollection for symbol ↵River Riddle1-12/+19
lookups This transforms the symbol lookups to O(1) from O(NM), greatly speeding up both passes. For a large MLIR module this shaved seconds off of the compilation time. Differential Revision: https://reviews.llvm.org/D89522
2020-08-30Improve doc comments for several methods returning boolsKamlesh Kumar1-1/+1
Differential Revision: https://reviews.llvm.org/D86848
2020-05-07[mlir] Add NamedAttrListJacques Pienaar1-1/+2
This is a wrapper around vector of NamedAttributes that keeps track of whether sorted and does some minimal effort to remain sorted (doing more, e.g., appending attributes in sorted order, could be done in follow up). It contains whether sorted and if a DictionaryAttr is queried, it caches the returned DictionaryAttr along with whether sorted. Change MutableDictionaryAttr to always return a non-null Attribute even when empty (reserve null cases for errors). To this end change the getter to take a context as input so that the empty DictionaryAttr could be queried. Also create one instance of the empty dictionary attribute that could be reused without needing to lock context etc. Update infer type op interface to use DictionaryAttr and use NamedAttrList to avoid incurring multiple conversion costs. Fix bug in sorting helper function. Differential Revision: https://reviews.llvm.org/D79463
2020-05-04[mlir][IR] Add a Region::getOps method that returns a range of immediately ↵River Riddle1-3/+2
nested operations This allows for walking the operations nested directly within a region, without traversing nested regions. Differential Revision: https://reviews.llvm.org/D79056
2020-04-29Rename NamedAttributeList to MutableDictionaryAttrJacques Pienaar1-1/+1
Makes the relationship and function clearer. Accordingly rename getAttrList to getMutableAttrDict. Differential Revision: https://reviews.llvm.org/D79125
2020-03-18[mlir] Add support for detecting single use callables in the Inliner.River Riddle1-0/+17
Summary: This is somewhat complex(annoying) as it involves directly tracking the uses within each of the callgraph nodes, and updating them as needed during inlining. The benefit of this is that we can have a more exact cost model, enable inlining some otherwise non-inlinable cases, and also ensure that newly dead callables are properly disposed of. Differential Revision: https://reviews.llvm.org/D75476
2020-03-10[mlir][NFC] Move the operation interfaces out of Analysis/ and into a new ↵River Riddle1-7/+1
Interfaces/ directory. The interfaces themselves aren't really analyses, they may be used by analyses though. Having them in Analysis can also create cyclic dependencies if an analysis depends on a specific dialect, that also provides one of the interfaces. Differential Revision: https://reviews.llvm.org/D75867
2020-02-08[mlir] Add a utility method on CallOpInterface for resolving the callable.River Riddle1-21/+7
Summary: This is the most common operation performed on a CallOpInterface. This just moves the existing functionality from the CallGraph so that other users can access it. Differential Revision: https://reviews.llvm.org/D74250
2020-01-26Mass update the MLIR license header to mention "Part of the LLVM project"Mehdi Amini1-1/+1
This is an artifact from merging MLIR into LLVM, the file headers are now aligned with the rest of the project.
2020-01-13[mlir] Update the CallGraph for nested symbol references, and simplify ↵River Riddle1-56/+25
CallableOpInterface Summary: This enables tracking calls that cross symbol table boundaries. It also simplifies some of the implementation details of CallableOpInterface, i.e. there can only be one region within the callable operation. Depends On D72042 Reviewed By: jpienaar Differential Revision: https://reviews.llvm.org/D72043
2020-01-11[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is ↵River Riddle1-1/+1
properly value-typed. Summary: These were temporary methods used to simplify the transition. Reviewed By: antiagainst Differential Revision: https://reviews.llvm.org/D72548
2019-12-23NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.River Riddle1-1/+1
ValuePtr was a temporary typedef during the transition to a value-typed Value. PiperOrigin-RevId: 286945714
2019-12-23Adjust License.txt file to use the LLVM licenseMehdi Amini1-13/+4
PiperOrigin-RevId: 286906740
2019-12-22NFC: Introduce new ValuePtr/ValueRef typedefs to simplify the transition to ↵River Riddle1-1/+1
Value being value-typed. This is an initial step to refactoring the representation of OpResult as proposed in: https://groups.google.com/a/tensorflow.org/g/mlir/c/XXzzKhqqF_0/m/v6bKb08WCgAJ This change will make it much simpler to incrementally transition all of the existing code to use value-typed semantics. PiperOrigin-RevId: 286844725
2019-11-20Fix 'the the' typo.Alexander Belyaev1-1/+1
PiperOrigin-RevId: 281501234
2019-11-11Add support for nested symbol references.River Riddle1-1/+3
This change allows for adding additional nested references to a SymbolRefAttr to allow for further resolving a symbol if that symbol also defines a SymbolTable. If a referenced symbol also defines a symbol table, a nested reference can be used to refer to a symbol within that table. Nested references are printed after the main reference in the following form: symbol-ref-attribute ::= symbol-ref-id (`::` symbol-ref-id)* Example: module @reference { func @nested_reference() } my_reference_op @reference::@nested_reference Given that SymbolRefAttr is now more general, the existing functionality centered around a single reference is moved to a derived class FlatSymbolRefAttr. Followup commits will add support to lookups, rauw, etc. for scoped references. PiperOrigin-RevId: 279860501
2019-10-10Add support for canonicalizing callable regions during inlining.River Riddle1-11/+31
This will allow for inlining newly devirtualized calls, as well as give a more accurate cost model(when we have one). Currently canonicalization will only run for nodes that have no child edges, as the child nodes may be erased during canonicalization. We can support this in the future, but it requires more intricate deletion tracking. PiperOrigin-RevId: 274011386
2019-09-23Add initial callgraph support.River Riddle1-0/+212
Using the two call interfaces, CallOpInterface and CallableOpInterface, this change adds support for an initial multi-level CallGraph. This call graph builds a set of nodes for each callable region, and connects them via edges. An edge may be any of the following types: * Abstract - An edge not produced by a call operation, used for connecting to internal nodes from external nodes. * Call - A call edge is an edge defined via a call-like operation. * Child - This is an artificial edge connecting nested callgraph nodes. This callgraph will be used, and improved upon, to begin supporting more interesting interprocedural analyses and transformation. In a followup, this callgraph will be used to support more complex inlining support. PiperOrigin-RevId: 270724968
2019-09-23Add interfaces for call-like/callable operations.River Riddle1-0/+31
These two operation interfaces will be used in a followup to support building a callgraph: * CallOpInterface - Operations providing this interface are call-like, and have a "call" target. A call target may be a symbol reference, via SymbolRefAttr, or a SSA value. * CallableOpInterface - Operations providing this interfaces define destinations to call-like operations, e.g. FuncOp. These operations may define any number of callable regions. PiperOrigin-RevId: 270723300