[llvm] [AMDGPU] Enable "amdgpu-sw-lower-lds" pass in pipeline. (PR #89206)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 22:46:16 PDT 2024


https://github.com/skc7 updated https://github.com/llvm/llvm-project/pull/89206

>From 4647b8a122f31b6a332a05c541476401037eed4b Mon Sep 17 00:00:00 2001
From: skc7 <Krishna.Sankisa at amd.com>
Date: Thu, 18 Apr 2024 15:58:10 +0530
Subject: [PATCH] [AMDGPU] Enable amdgpu-sw-lower-lds pass in pipeline.

---
 llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index ce997c659094a..c6b0755347c0d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -342,6 +342,10 @@ static cl::opt<bool, true> EnableLowerModuleLDS(
     cl::location(AMDGPUTargetMachine::EnableLowerModuleLDS), cl::init(true),
     cl::Hidden);
 
+static cl::opt<bool> EnableSwLowerLDS("amdgpu-enable-sw-lower-lds",
+                                      cl::desc("Enable sw lower lds pass"),
+                                      cl::init(true), cl::Hidden);
+
 static cl::opt<bool> EnablePreRAOptimizations(
     "amdgpu-enable-pre-ra-optimizations",
     cl::desc("Enable Pre-RA optimizations pass"), cl::init(true),
@@ -732,6 +736,12 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(
         PM.addPass(createCGSCCToFunctionPassAdaptor(std::move(FPM)));
       });
 
+  PB.registerOptimizerLastEPCallback(
+      [this](ModulePassManager &PM, OptimizationLevel Level) {
+        if (EnableSwLowerLDS)
+          PM.addPass(AMDGPUSwLowerLDSPass());
+      });
+
   PB.registerFullLinkTimeOptimizationLastEPCallback(
       [this](ModulePassManager &PM, OptimizationLevel Level) {
         // We want to support the -lto-partitions=N option as "best effort".



More information about the llvm-commits mailing list