[all-commits] [llvm/llvm-project] 901183: [IPO] Opt-in local clones for thinlto imports

Mircea Trofin via All-commits all-commits at lists.llvm.org
Thu May 11 15:57:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 901183b5964c84d3ab6a3896b2c0ced7ffbd00f5
      https://github.com/llvm/llvm-project/commit/901183b5964c84d3ab6a3896b2c0ced7ffbd00f5
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2023-05-11 (Thu, 11 May 2023)

  Changed paths:
    M llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
    A llvm/test/Transforms/EliminateAvailableExternally/transform-to-local.ll

  Log Message:
  -----------
  [IPO] Opt-in local clones for thinlto imports

ThinLTO imports (which appear as `available_externally`) that survive
inlining get deleted. With today's inliner that's reasonable, because
the way the function would be inlined into in other modules would be the
same - because of the bottom-up traversal assumption, and the fact that
the inliner doesn't take into account surrounding context [*]. The
ModuleInliner invalidates the first assumption, and the ML inliner the
second.

This patch adds a way to opt-in a module to keep its variant of an
imported function, even if it survived past inlining.

[*] Almost. Deferred inlining is an exception which can lead to
(empirically) infrequent discrepancies.

Differential Revision: https://reviews.llvm.org/D150148




More information about the All-commits mailing list