[llvm] [AMDGPU]: Rewrite mbcnt_lo/mbcnt_hi to work item ID where applicable (PR #160496)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 11:37:53 PDT 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 origin/main HEAD --extensions cpp -- llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
index 509e2b019..a2d7733a0 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
@@ -1375,8 +1375,8 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
         if (ST) {
           if (auto MaybeX = ST->getReqdWorkGroupSize(*F, 0)) {
             unsigned XLen = *MaybeX;
-            if (Wave == 0 && (XLen == WavefrontSize32 ||
-                              XLen == WavefrontSize64))
+            if (Wave == 0 &&
+                (XLen == WavefrontSize32 || XLen == WavefrontSize64))
               Wave = XLen; // allow common sizes under test harness
 
             if (Wave != 0 && XLen == Wave) {
@@ -1392,9 +1392,9 @@ GCNTTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
             // replace lane-id computation with a bitmask when the wave is a
             // power-of-two. Use the Subtarget helper to conservatively decide
             // when per-wave tiling is preserved.
-        if (ST->hasWavefrontsEvenlySplittingXDim(
-          *F, /*RequiresUniformYZ=*/true)) {
-        if (Wave != 0 && isPowerOf2_32(Wave)) {
+            if (ST->hasWavefrontsEvenlySplittingXDim(
+                    *F, /*RequiresUniformYZ=*/true)) {
+              if (Wave != 0 && isPowerOf2_32(Wave)) {
                 // Construct: tid = workitem.id.x(); mask = Wave-1; res = tid &
                 // mask
                 SmallVector<Type *, 0> OverloadTys;

``````````

</details>


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


More information about the llvm-commits mailing list