[llvm] [AMDGPU] Filter candidates of LiveRegOptimizer for profitable cases (PR #124624)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 13:00:44 PST 2025


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 c24e5f982e2791768aeea8b1fb55e951f80aad75 94334e44d32e90ae33a415fcc856094dbbaa2c38 --extensions cpp -- llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
index d64951001d..e24b8701ca 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULateCodeGenPrepare.cpp
@@ -55,8 +55,8 @@ class AMDGPULateCodeGenPrepare
 
 public:
   AMDGPULateCodeGenPrepare(Function &F, const GCNSubtarget &ST,
-                           const TargetTransformInfo &TTI,
-                           AssumptionCache *AC, UniformityInfo &UA)
+                           const TargetTransformInfo &TTI, AssumptionCache *AC,
+                           UniformityInfo &UA)
       : F(F), DL(F.getDataLayout()), ST(ST), TTI(TTI), AC(AC), UA(UA) {}
   bool run();
   bool visitInstruction(Instruction &) { return false; }
@@ -140,12 +140,10 @@ public:
       return false;
 
     // Instruction Cost
-    const auto Cost = TTI.getInstructionCost(II,
-        TargetTransformInfo::TargetCostKind::TCK_SizeAndLatency);
-    LLVM_DEBUG(
-      dbgs() << "shouldReplaceBasedOnOp: " <<
-        *II << " Cost=" << Cost << '\n';
-    );
+    const auto Cost = TTI.getInstructionCost(
+        II, TargetTransformInfo::TargetCostKind::TCK_SizeAndLatency);
+    LLVM_DEBUG(dbgs() << "shouldReplaceBasedOnOp: " << *II << " Cost=" << Cost
+                      << '\n';);
     if (Cost >= 8)
       return true;
 
@@ -165,7 +163,7 @@ public:
   }
 
   LiveRegOptimizer(Module &Mod, const GCNSubtarget &ST,
-      const TargetTransformInfo &TTI)
+                   const TargetTransformInfo &TTI)
       : Mod(Mod), DL(Mod.getDataLayout()), ST(ST), TTI(TTI),
         ConvertToScalar(Type::getInt32Ty(Mod.getContext())) {}
 };

``````````

</details>


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


More information about the llvm-commits mailing list