[llvm] [CodeGen][NewPM] Use proper NPM AtomicExpandPass in AMDGPU (PR #122086)
Akshat Oke via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 02:17:21 PST 2025
https://github.com/optimisan created https://github.com/llvm/llvm-project/pull/122086
I couldn't reproduce the build failures that FIXME referenced, maybe the Dummy pass getting in the way was part of the cause.
>From f2ec24f57d7037bfe413aa9afc588af8d9989f9d Mon Sep 17 00:00:00 2001
From: Akshat Oke <Akshat.Oke at amd.com>
Date: Wed, 8 Jan 2025 09:55:14 +0000
Subject: [PATCH] [CodeGen][NewPM] Use proper NPM AtomicExpandPass in AMDGPU
I couldn't reproduce the build failures that FIXME referenced, maybe the
Dummy pass getting in the way was part of the cause.
---
llvm/include/llvm/Passes/MachinePassRegistry.def | 1 -
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def
index 29763995e8b516..8a43197d2d45ea 100644
--- a/llvm/include/llvm/Passes/MachinePassRegistry.def
+++ b/llvm/include/llvm/Passes/MachinePassRegistry.def
@@ -194,7 +194,6 @@ MACHINE_FUNCTION_PASS_WITH_PARAMS(
#ifndef DUMMY_FUNCTION_PASS
#define DUMMY_FUNCTION_PASS(NAME, PASS_NAME)
#endif
-DUMMY_FUNCTION_PASS("atomic-expand", AtomicExpandPass)
#undef DUMMY_FUNCTION_PASS
#ifndef DUMMY_MACHINE_MODULE_PASS
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 7256eec89008a5..f825949fccd4ae 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -48,6 +48,7 @@
#include "llvm/Analysis/CGSCCPassManager.h"
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/UniformityAnalysis.h"
+#include "llvm/CodeGen/AtomicExpand.h"
#include "llvm/CodeGen/DeadMachineInstructionElim.h"
#include "llvm/CodeGen/GlobalISel/CSEInfo.h"
#include "llvm/CodeGen/GlobalISel/IRTranslator.h"
@@ -1953,8 +1954,7 @@ void AMDGPUCodeGenPassBuilder::addIRPasses(AddIRPass &addPass) const {
(AMDGPUAtomicOptimizerStrategy != ScanOptions::None))
addPass(AMDGPUAtomicOptimizerPass(TM, AMDGPUAtomicOptimizerStrategy));
- // FIXME: Adding atomic-expand manages to break -passes=atomic-expand
- // addPass(AtomicExpandPass(TM));
+ addPass(AtomicExpandPass(&TM));
if (TM.getOptLevel() > CodeGenOptLevel::None) {
addPass(AMDGPUPromoteAllocaPass(TM));
More information about the llvm-commits
mailing list