[all-commits] [llvm/llvm-project] 81a7b6: [MLIR][LLVM] Recursion importer handle repeated se...

Billy Zhu via All-commits all-commits at lists.llvm.org
Mon Apr 8 01:10:15 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81a7b6454e195f2051b76d9e5b1f0c430df0f502
      https://github.com/llvm/llvm-project/commit/81a7b6454e195f2051b76d9e5b1f0c430df0f502
  Author: Billy Zhu <billyzhu at modular.com>
  Date:   2024-04-08 (Mon, 08 Apr 2024)

  Changed paths:
    M mlir/lib/Target/LLVMIR/DebugImporter.cpp
    M mlir/lib/Target/LLVMIR/DebugImporter.h
    M mlir/lib/Target/LLVMIR/DebugTranslation.cpp
    M mlir/test/Target/LLVMIR/Import/debug-info.ll
    M mlir/test/Target/LLVMIR/llvmir-debug.mlir

  Log Message:
  -----------
  [MLIR][LLVM] Recursion importer handle repeated self-references (#87295)

Followup to this discussion:
https://github.com/llvm/llvm-project/pull/80251#discussion_r1535599920.

The previous debug importer was correct but inefficient. For cases with
mutual recursion that contain more than one back-edge, each back-edge
would result in a new translated instance. This is because the previous
implementation never caches any translated result with unbounded
self-references. This means all translation inside a recursive context
is performed from scratch, which will incur repeated run-time cost as
well as repeated attribute sub-trees in the translated IR (differing
only in their `recId`s).

This PR refactors the importer to handle caching inside a recursive
context.
- In the presence of unbound self-refs, the translation result is cached
in a separate cache that keeps track of the set of dependent unbound
self-refs.
- A dependent cache entry is valid only when all the unbound self-refs
are in scope. Whenever a cached entry goes out of scope, it will be
removed the next time it is looked up.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list