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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 02:06:34 PDT 2024


================
@@ -5168,7 +5219,8 @@ bool CombinerHelper::matchUDivByConst(MachineInstr &MI) {
   Register RHS = MI.getOperand(2).getReg();
   LLT DstTy = MRI.getType(Dst);
   auto *RHSDef = MRI.getVRegDef(RHS);
-  if (!isConstantOrConstantVector(*RHSDef, MRI))
+  if (!MI.getFlag(MachineInstr::MIFlag::IsExact) &&
+      !isConstantOrConstantVector(*RHSDef, MRI))
----------------
jayfoad wrote:

What's the reason for this change?

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


More information about the llvm-commits mailing list