[llvm] [AArch64][GlobalISel] Lower G_BUILD_VECTOR to G_INSERT_VECTOR_ELT (PR #105686)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 22 10:22:48 PDT 2024
================
@@ -1048,6 +1048,45 @@ void applyLowerVectorFCMP(MachineInstr &MI, MachineRegisterInfo &MRI,
MI.eraseFromParent();
}
+// Intend to match the last part of
+// AArch64TargetLowering::LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG)
+bool matchLowerBuildToInsertVecElt(MachineInstr &MI, MachineRegisterInfo &MRI) {
+ assert(MI.getOpcode() == TargetOpcode::G_BUILD_VECTOR &&
+ "Expected G_BUILD_VECTOR instruction");
+ bool isConstant = true;
+
+ // Check if the values are the same
+ for (unsigned i = 1; i < MI.getNumOperands(); i++) {
+ auto ConstVal =
+ getAnyConstantVRegValWithLookThrough(MI.getOperand(i).getReg(), MRI);
+ if (!ConstVal.has_value()) {
+ isConstant = false;
+ }
----------------
tschuett wrote:
`break;`
https://github.com/llvm/llvm-project/pull/105686
More information about the llvm-commits
mailing list