[llvm] [AMDGPU] Identify vector idiom to unlock SROA (PR #161200)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 29 07:04:09 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 h,cpp -- llvm/lib/Target/AMDGPU/AMDGPUVectorIdiom.cpp llvm/lib/Target/AMDGPU/AMDGPUVectorIdiom.h llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.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/AMDGPUVectorIdiom.cpp b/llvm/lib/Target/AMDGPU/AMDGPUVectorIdiom.cpp
index 2703fff9f..89d061231 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUVectorIdiom.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUVectorIdiom.cpp
@@ -414,8 +414,10 @@ AMDGPUVectorIdiomCombinePass::run(Function &F, FunctionAnalysisManager &FAM) {
           Value *Fv = SI->getFalseValue();
           dumpPtrForms("true", T);
           dumpPtrForms("false", Fv);
-          dbgs() << "      trueIsAlloca=" << (hasAllocaUnderlyingObject(T) ? "true" : "false") << '\n';
-          dbgs() << "      falseIsAlloca=" << (hasAllocaUnderlyingObject(Fv) ? "true" : "false") << '\n';
+          dbgs() << "      trueIsAlloca="
+                 << (hasAllocaUnderlyingObject(T) ? "true" : "false") << '\n';
+          dbgs() << "      falseIsAlloca="
+                 << (hasAllocaUnderlyingObject(Fv) ? "true" : "false") << '\n';
         }
       };
 
@@ -432,10 +434,10 @@ AMDGPUVectorIdiomCombinePass::run(Function &F, FunctionAnalysisManager &FAM) {
              << '\n'
              << "  - dstIsSelect=" << (isa<SelectInst>(DstV) ? "true" : "false")
              << '\n'
-             << "  - srcIsAlloca=" << (hasAllocaUnderlyingObject(SrcV) ? "true" : "false")
-             << '\n'
-             << "  - dstIsAlloca=" << (hasAllocaUnderlyingObject(DstV) ? "true" : "false")
-             << '\n';
+             << "  - srcIsAlloca="
+             << (hasAllocaUnderlyingObject(SrcV) ? "true" : "false") << '\n'
+             << "  - dstIsAlloca="
+             << (hasAllocaUnderlyingObject(DstV) ? "true" : "false") << '\n';
 
       dumpSelect("src", SrcV);
       dumpSelect("dst", DstV);
@@ -468,7 +470,8 @@ AMDGPUVectorIdiomCombinePass::run(Function &F, FunctionAnalysisManager &FAM) {
       continue;
     }
 
-    // Check if we have select instructions and if their operands are alloca-based
+    // Check if we have select instructions and if their operands are
+    // alloca-based
     bool ShouldTransform = false;
     if (auto *Sel = dyn_cast<SelectInst>(Src)) {
       bool TrueIsAlloca = hasAllocaUnderlyingObject(Sel->getTrueValue());
@@ -489,8 +492,9 @@ AMDGPUVectorIdiomCombinePass::run(Function &F, FunctionAnalysisManager &FAM) {
         ShouldTransform = true;
         Changed |= Impl.transformSelectMemcpyDest(*MT, *Sel);
       } else {
-        LLVM_DEBUG(dbgs() << "[AMDGPUVectorIdiom] Skip: select destination operands "
-                          << "are not alloca-based\n");
+        LLVM_DEBUG(
+            dbgs() << "[AMDGPUVectorIdiom] Skip: select destination operands "
+                   << "are not alloca-based\n");
       }
       continue;
     }

``````````

</details>


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


More information about the llvm-commits mailing list