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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 23:24:11 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)))
----------------
arsenm wrote:

Does the HasOneUse predicate added in d0dc29c2084a18c33b1b5b1cad9fd42215869746 need additional wiring to be used in combines? 

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


More information about the llvm-commits mailing list