[llvm] [AMDGPU] Do not scale private alloca size when using flat-scratch (PR #201142)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 04:18:51 PDT 2026


Juan Manuel Martinez =?utf-8?q?Caamaño?=,
Juan Manuel Martinez =?utf-8?q?Caamaño?=,
Juan Manuel Martinez =?utf-8?q?Caamaño?=,
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/201142 at github.com>


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/AMDGPURegisterBankInfo.cpp llvm/lib/Target/AMDGPU/SIISelLowering.cpp --diff_from_common_commit
``````````

: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/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index 56465f280..8af76959b 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -4700,9 +4700,11 @@ SDValue SITargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
   if (isa<ConstantSDNode>(Size)) {
     // Increase the stack pointer by the size of the alloca.
     // If not using flat-scratch, we have to scale the size by the wave-size.
-    SDValue ScaledSize = HasFlatScratch ? Size : 
-          DAG.getNode(ISD::SHL, dl, VT, Size,
-                      DAG.getConstant(WavefrontSizeLog2, dl, MVT::i32));
+    SDValue ScaledSize =
+        HasFlatScratch
+            ? Size
+            : DAG.getNode(ISD::SHL, dl, VT, Size,
+                          DAG.getConstant(WavefrontSizeLog2, dl, MVT::i32));
     NewSP = DAG.getNode(ISD::ADD, dl, VT, BaseAddr, ScaledSize); // Value
   } else {
     // For dynamic sized alloca, perform wave-wide reduction to get max of

``````````

</details>


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


More information about the llvm-commits mailing list