[llvm] [GlobalISel] Handle div-by-pow2 (PR #83155)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 06:31:40 PDT 2024


================
@@ -1036,7 +1037,20 @@ def sdiv_by_const : GICombineRule<
    [{ return Helper.matchSDivByConst(*${root}); }]),
   (apply [{ Helper.applySDivByConst(*${root}); }])>;
 
-def intdiv_combines : GICombineGroup<[udiv_by_const, sdiv_by_const]>;
+def sdiv_by_pow2 : GICombineRule<
+  (defs root:$root),
+  (match (G_SDIV $dst, $x, $y, (MIFlags (not IsExact))):$root,
----------------
jayfoad wrote:

Are there any tests showing that your combine does nothing on an exact div?

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


More information about the llvm-commits mailing list