[llvm] Port Swift's merge function pass to llvm: merging functions that differ in constants (PR #68235)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 23:59:33 PDT 2023


================
@@ -0,0 +1,1430 @@
+//===--- MergeFunctionsIgnoringConst.cpp - Merge functions ----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This pass looks for similar functions that are mergeable and folds them.
+// The implementation is similar to LLVM's MergeFunctions pass. Instead of
+// merging identical functions, it merges functions which only differ by a few
+// constants in certain instructions.
+// This is copied from Swift's implementation.
+// TODO: We should generalize this pass and share it with Swift's
+// implementation.
----------------
eeckstein wrote:

I don't think there is problem that we use the pass in swift. The only thing we need is an option to configure how to name the created thunks (see my other comment).

https://github.com/llvm/llvm-project/pull/68235


More information about the llvm-commits mailing list