[llvm] [AMDGPU][NewInsertWaitcnts] Boilerplate for the new wait insertion pass (PR #226335)

Vasileios Porpodas via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 19:37:56 PDT 2026


================
@@ -0,0 +1,49 @@
+//===--- AMDGPUNewInsertWaitcnts.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_LIB_TARGET_AMDGPU_AMDGPUNEWINSERTWAITCNTS_AMDGPUNEWINSERTWAITCNTS_H
+#define LLVM_LIB_TARGET_AMDGPU_AMDGPUNEWINSERTWAITCNTS_AMDGPUNEWINSERTWAITCNTS_H
+
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFunctionAnalysisManager.h"
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+namespace AMDGPU {
+
+/// The main class of the wait insertion pass.
+class InsertWaitcnts {
+  /// The bulk of the wait insertion logic is in this function. Returns true if
+  /// the IR was modified.
+  bool insertWaitcntsAtMF(MachineFunction &MF);
+
+public:
+  InsertWaitcnts() = default;
+  /// The main entry point of wait insertion into \p MF. Returns true if the IR
+  /// is modified.
+  bool run(MachineFunction &MF);
+};
+
+} // namespace AMDGPU
+
+class AMDGPUNewInsertWaitcntsPass
+    : public OptionalPassInfoMixin<AMDGPUNewInsertWaitcntsPass> {
+  AMDGPU::InsertWaitcnts IW;
+
+  bool insertWaitcntsMF(MachineFunction &MF);
----------------
vporpo wrote:

Oops good catch :)

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


More information about the llvm-commits mailing list