[llvm] [CodeGen] Emit more efficient magic numbers for exact udivs (PR #87161)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 11:59:19 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:
> Doesn't matchUnaryPredicate fail to match if its not a constant or constant vector?
I believe so. I just moved it out of caution because the SDIV version doesn't call the isConstantOrConstantVector method, but UDIV does, and the SDIV version only supports exact division.
So this was really for the sake of least disruption. However if it is redundant after all, it would have been redundant to begin with.
https://github.com/llvm/llvm-project/pull/87161
More information about the llvm-commits
mailing list