[llvm] [GlobalIsel] Combine G_VSCALE (PR #94096)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 23:39:20 PDT 2024


================
@@ -400,3 +401,86 @@ bool CombinerHelper::matchInsertVectorElementOOB(MachineInstr &MI,
 
   return false;
 }
+
+bool CombinerHelper::matchAddOfVScale(const MachineOperand &MO,
+                                      BuildFnTy &MatchInfo) {
+  GAdd *Add = cast<GAdd>(MRI.getVRegDef(MO.getReg()));
+  GVScale *LHSVScale = cast<GVScale>(MRI.getVRegDef(Add->getLHSReg()));
+  GVScale *RHSVScale = cast<GVScale>(MRI.getVRegDef(Add->getRHSReg()));
+
+  Register Dst = Add->getReg(0);
+
+  if (!MRI.hasOneNonDBGUse(LHSVScale->getReg(0)) ||
+      !MRI.hasOneNonDBGUse(RHSVScale->getReg(0)))
----------------
tschuett wrote:

>From a brief reading, it seems to be limited to instruction emitters and cannot be used in the combiner.

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


More information about the llvm-commits mailing list