[llvm] [BPF] Use mul for certain div/mod operations (PR #110712)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 13:02:02 PDT 2024


================
@@ -118,7 +118,9 @@ class BPFTargetLowering : public TargetLowering {
     return Op.size() >= 8 ? MVT::i64 : MVT::i32;
   }
 
-  bool isIntDivCheap(EVT VT, AttributeList Attr) const override { return true; }
+  bool isIntDivCheap(EVT VT, AttributeList Attr) const override {
+    return false;
----------------
eddyz87 wrote:

> > Do we also need to add some generic lowering for cpuv{1,2,3}?
> 
> you mean to lower sdiv into udiv plus conditionals ?

Yes

> It's doable, but let's do it in the separate patch and it's not a high priority imo.

If we are sure that optimization pattern that fires in this case would cover all other uses, then yes, lower priority.

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


More information about the llvm-commits mailing list