[llvm] [AArch64][GlobalISel] Add combine for build_vector(unmerge, unmerge, undef, undef) (PR #165539)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 3 07:50:31 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 origin/main HEAD --extensions cpp,h -- llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerCombiner.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/CodeGen/GlobalISel/CombinerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index 54b3c423d..e56d1fe3b 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -3495,11 +3495,13 @@ bool CombinerHelper::matchCombineBuildUnmerge(MachineInstr &MI,
     return false;
 
   LLT DstTy = MRI.getType(MI.getOperand(0).getReg());
-  LLT UnmergeSrcTy = MRI.getType(MaybeUnmerge->getOperand(MaybeUnmerge->getNumOperands()-1).getReg());
+  LLT UnmergeSrcTy = MRI.getType(
+      MaybeUnmerge->getOperand(MaybeUnmerge->getNumOperands() - 1).getReg());
 
   // Ensure we only generate legal instructions post-legalizer
-  if (!IsPreLegalize && !isLegal({TargetOpcode::G_CONCAT_VECTORS, {DstTy, UnmergeSrcTy, UnmergeSrcTy}}))
-      return false;
+  if (!IsPreLegalize && !isLegal({TargetOpcode::G_CONCAT_VECTORS,
+                                  {DstTy, UnmergeSrcTy, UnmergeSrcTy}}))
+    return false;
 
   // Check that all of the operands before the midpoint come from the same
   // unmerge and are in the same order as they are used in the build_vector
@@ -3526,7 +3528,8 @@ bool CombinerHelper::matchCombineBuildUnmerge(MachineInstr &MI,
       return false;
   }
 
-  UnmergeSrc = MaybeUnmerge->getOperand(MaybeUnmerge->getNumOperands()-1).getReg();
+  UnmergeSrc =
+      MaybeUnmerge->getOperand(MaybeUnmerge->getNumOperands() - 1).getReg();
 
   return true;
 }

``````````

</details>


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


More information about the llvm-commits mailing list