[llvm] [AMDGPU][NewPM] Port TailDuplicate pass to NPM (PR #113293)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 05:20:34 PDT 2024


================
@@ -0,0 +1,47 @@
+//===- llvm/CodeGen/TailDuplication.h ---------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CODEGEN_TAILDUPLICATIONPASS_H
+#define LLVM_CODEGEN_TAILDUPLICATIONPASS_H
+
+#include "llvm/CodeGen/MBFIWrapper.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachinePassManager.h"
+
+namespace llvm {
+
+template <typename DerivedT, bool PreRegAlloc>
+class TailDuplicatePassBase : public PassInfoMixin<DerivedT> {
+private:
+  std::unique_ptr<MBFIWrapper> MBFIW;
----------------
paperchalice wrote:

IIUC `MBFIWrapper` exists here because legacy pass manager can't compute analysis results lazily. In new pass manager we can just use `MFAM.getResult<MachineBlockFrequencyAnalysis>()`, all results are computed lazily.

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


More information about the llvm-commits mailing list