[llvm] [AMDGPU][NewPM] Port SIPeepholeSDWA pass to NPM (PR #107049)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 22:16:59 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff da13754103b8880811f4c164d858c6dd3c393927 f785d63f684ee743f7f5479bf32dd1c95fb29132 --extensions h,cpp -- llvm/lib/Target/AMDGPU/SIPeepholeSDWA.h llvm/lib/Target/AMDGPU/AMDGPU.h llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
index dc18be77dd..776652c499 100644
--- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
+++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.cpp
@@ -66,7 +66,7 @@ private:
   void legalizeScalarOperands(MachineInstr &MI, const GCNSubtarget &ST) const;
 
 public:
-  bool run(MachineFunction& MF); 
+  bool run(MachineFunction &MF);
 };
 
 class SIPeepholeSDWALegacy : public MachineFunctionPass {
@@ -197,7 +197,8 @@ public:
 
 } // end anonymous namespace
 
-INITIALIZE_PASS(SIPeepholeSDWALegacy, DEBUG_TYPE, "SI Peephole SDWA", false, false)
+INITIALIZE_PASS(SIPeepholeSDWALegacy, DEBUG_TYPE, "SI Peephole SDWA", false,
+                false)
 
 char SIPeepholeSDWALegacy::ID = 0;
 
@@ -207,7 +208,6 @@ FunctionPass *llvm::createSIPeepholeSDWALegacyPass() {
   return new SIPeepholeSDWALegacy();
 }
 
-
 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
 static raw_ostream& operator<<(raw_ostream &OS, SdwaSel Sel) {
   switch(Sel) {
@@ -1240,8 +1240,8 @@ void SIPeepholeSDWA::legalizeScalarOperands(MachineInstr &MI,
   }
 }
 
-bool SIPeepholeSDWALegacy::runOnMachineFunction(MachineFunction& MF) {
-  if(skipFunction(MF.getFunction())) {
+bool SIPeepholeSDWALegacy::runOnMachineFunction(MachineFunction &MF) {
+  if (skipFunction(MF.getFunction())) {
     return false;
   }
   return SIPeepholeSDWA().run(MF);
@@ -1308,14 +1308,15 @@ bool SIPeepholeSDWA::run(MachineFunction &MF) {
   return Ret;
 }
 
-PreservedAnalyses SIPeepholeSDWAPass::run(MachineFunction& MF, MachineFunctionAnalysisManager&) {
-  if(MF.getFunction().hasOptNone()) 
+PreservedAnalyses SIPeepholeSDWAPass::run(MachineFunction &MF,
+                                          MachineFunctionAnalysisManager &) {
+  if (MF.getFunction().hasOptNone())
     return PreservedAnalyses::all();
-  
+
   bool Changed = SIPeepholeSDWA().run(MF);
-  if(!Changed) 
+  if (!Changed)
     return PreservedAnalyses::all();
-  
+
   PreservedAnalyses PA = getMachineFunctionPassPreservedAnalyses();
   PA.preserveSet<CFGAnalyses>();
   return PA;
diff --git a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.h b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.h
index adf18e7f13..8d4a2efd93 100644
--- a/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.h
+++ b/llvm/lib/Target/AMDGPU/SIPeepholeSDWA.h
@@ -14,8 +14,7 @@
 
 namespace llvm {
 
-class SIPeepholeSDWAPass
-    : public PassInfoMixin<SIPeepholeSDWAPass> {
+class SIPeepholeSDWAPass : public PassInfoMixin<SIPeepholeSDWAPass> {
 public:
   PreservedAnalyses run(MachineFunction &MF,
                         MachineFunctionAnalysisManager &MFAM);

``````````

</details>


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


More information about the llvm-commits mailing list