[llvm] [CodeGen] Emit more efficient magic numbers for exact udivs (PR #87161)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 11:34:37 PDT 2024


================
@@ -5283,9 +5333,6 @@ bool CombinerHelper::matchUDivByConst(MachineInstr &MI) {
   Register Dst = MI.getOperand(0).getReg();
   Register RHS = MI.getOperand(2).getReg();
   LLT DstTy = MRI.getType(Dst);
-  auto *RHSDef = MRI.getVRegDef(RHS);
----------------
AtariDreams wrote:

No it does not. In addition, just like SDIV, the predicate below is what is needed as long as it is exact.

If it is not exact, then it requires a constant or constant vector.

If this isn't true, then SDIV will have to be fixed as well. However, this patch doesn't touch that.

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


More information about the llvm-commits mailing list