aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
diff options
context:
space:
mode:
authorjeanPerier <jperier@nvidia.com>2024-04-02 10:22:03 +0200
committerGitHub <noreply@github.com>2024-04-02 10:22:03 +0200
commit2d14ea68b8c0acdff7c040d581f7fde15d2683d9 (patch)
tree11e9702c29fcebbfc620025e42ad485c4878a104 /clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp
parentfa8dc363506893eb9371dd3b7590f41fa9a7174a (diff)
downloadllvm-2d14ea68b8c0acdff7c040d581f7fde15d2683d9.zip
llvm-2d14ea68b8c0acdff7c040d581f7fde15d2683d9.tar.gz
llvm-2d14ea68b8c0acdff7c040d581f7fde15d2683d9.tar.bz2
[flang][NFC] speed-up external name conversion pass (#86814)
The ExternalNameConversion pass can be surprisingly slow on big programs. On an example with a 50kloc Fortran file with about 10000 calls to external procedures, the pass alone took 25s on my machine. This patch reduces this to 0.16s. The root cause is that using `replaceAllSymbolUses` on each modified FuncOp is very expensive: it is walking all operations and attribute every time. An alternative would be to use mlir::SymbolUserMap to avoid walking the module again and again, but this is still much more expensive than what is needed because it is essentially caching all symbol uses of the module, and there is no need to such caching here. Instead: - Do a shallow walk of the module (only top level operation) to detect FuncOp/GlobalOp that needs to be updated. Update them and place the name remapping in a DenseMap. - If any remapping were done, do a single deep walk of the module operation, and update any SymbolRefAttr that matches a name that was remapped.
Diffstat (limited to 'clang/lib/ExtractAPI/Serialization/SymbolGraphSerializer.cpp')
0 files changed, 0 insertions, 0 deletions