[llvm] [AArch64][GlobalISel] Add combine for build_vector(unmerge, unmerge, undef, undef) (PR #165539)
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 6 21:25:12 PST 2025
================
@@ -3463,6 +3464,89 @@ static bool isConstValidTrue(const TargetLowering &TLI, unsigned ScalarSizeBits,
isConstTrueVal(TLI, Cst, IsVector, IsFP);
}
+// This pattern aims to match the following shape to avoid extra mov
+// instructions
+// G_BUILD_VECTOR(
+// G_UNMERGE_VALUES(src, 0)
+// G_UNMERGE_VALUES(src, 1)
+// G_IMPLICIT_DEF
+// G_IMPLICIT_DEF
+// )
+// ->
+// G_CONCAT_VECTORS(
+// src,
+// undef
+// )
+bool CombinerHelper::matchCombineBuildUnmerge(MachineInstr &MI,
+ MachineRegisterInfo &MRI,
+ Register &UnmergeSrc) const {
+ assert(MI.getOpcode() == TargetOpcode::G_BUILD_VECTOR);
----------------
aemerson wrote:
If you do:
```
auto &BV = cast<GBuildVector>(MI);
```
You can skip this assert and get some convenience helpers.
https://github.com/llvm/llvm-project/pull/165539
More information about the llvm-commits
mailing list