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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 06:01:51 PDT 2023


================
@@ -0,0 +1,39 @@
+//===- MergeFunctionsIgnoringConst.h - Merge Functions ----------*- C++ -*-===//
+//
+// 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 transforms simple global variables that never have their address
+// taken.  If obviously true, it marks read/write globals as constant, deletes
+// variables only stored to, etc.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_IPO_MERGEFUNCTIONSIGNORINGCONST_H
+#define LLVM_TRANSFORMS_IPO_MERGEFUNCTIONSIGNORINGCONST_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class Module;
+
+/// Merge functions that differ by constants.
+class MergeFuncIgnoringConstPass
----------------
fhahn wrote:

Might be worth spelling out `Constant here in the name and elsewhere, as it is clearer an

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


More information about the llvm-commits mailing list