[llvm] [AArch64][GlobalISel] Fold buildvector of bitcast (PR #141553)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 10:38:12 PDT 2025


================
@@ -386,6 +386,75 @@ void CombinerHelper::applyCombineConcatVectors(
   MI.eraseFromParent();
 }
 
+bool CombinerHelper::matchCombineBuildVectorOfBitcast(
+    MachineInstr &MI, SmallVector<Register> &Ops) const {
+  assert(MI.getOpcode() == TargetOpcode::G_BUILD_VECTOR &&
+         "Invalid instruction");
----------------
aemerson wrote:

Can replace this with a `auto &BV = cast<GBuildVector>(MI);` which does an assertion for you. Then you have the `getNumSources()` and `getSourceReg(I)` helpers you can use later.

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


More information about the llvm-commits mailing list