[llvm] [AMDGPU] Introduce conditional barrier pseudo instruction (PR #171604)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 08:45:31 PST 2025
================
@@ -0,0 +1,147 @@
+//===-- AMDGPUExpandCondBarrier.cpp - Expand conditional barriers ------===//
+//
+// 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 expands SI_COND_BARRIER pseudo instructions into conditional
+// control flow with actual barrier instructions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "AMDGPU.h"
+#include "GCNSubtarget.h"
+#include "SIInstrInfo.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineInstrBuilder.h"
+#include "llvm/InitializePasses.h"
+
+using namespace llvm;
+
+#define DEBUG_TYPE "amdgpu-expand-cond-barrier"
+
+class AMDGPUExpandCondBarrier : public MachineFunctionPass {
+public:
+ static char ID;
+
+ AMDGPUExpandCondBarrier() : MachineFunctionPass(ID) {}
+
+ bool runOnMachineFunction(MachineFunction &MF) override;
+
+ StringRef getPassName() const override {
+ return "AMDGPU Expand Conditional Barriers";
+ }
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override {
+ // We modify the CFG, so don't call setPreservesCFG().
----------------
arsenm wrote:
```suggestion
```
https://github.com/llvm/llvm-project/pull/171604
More information about the llvm-commits
mailing list