]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
fold: Remove div_if_zero_remainder [PR122437]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Mon, 27 Oct 2025 23:20:40 +0000 (16:20 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 31 Oct 2025 06:37:18 +0000 (23:37 -0700)
While looking into something related to fold-const.cc, I noticed
that div_if_zero_remainder was unused. The last use of it was
removed in r5-3374-gf65586dcd19846 (via the removal of try_move_mult_to_index),
over 11 years ago.  So it is time to remove this unused function too.
Plus this function is just a small wrapper around wi::multiple_of_p but
creating trees which can get expensive so folks should use wi::multiple_of_p
directly instead.

Bootstrapped and tested on x86_64-linux-gnu.

PR tree-optimization/122437
gcc/ChangeLog:

* fold-const.cc (div_if_zero_remainder): Remove.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/fold-const.cc

index 1311c6ed7de12835ce38d71ca09527c269cc1936..861d73ce9607a34bec2f65a783a1a34f64bc0180 100644 (file)
@@ -264,22 +264,6 @@ protected_set_expr_location_unshare (tree x, location_t loc)
   return x;
 }
 \f
-/* If ARG2 divides ARG1 with zero remainder, carries out the exact
-   division and returns the quotient.  Otherwise returns
-   NULL_TREE.  */
-
-tree
-div_if_zero_remainder (const_tree arg1, const_tree arg2)
-{
-  widest_int quo;
-
-  if (wi::multiple_of_p (wi::to_widest (arg1), wi::to_widest (arg2),
-                        SIGNED, &quo))
-    return wide_int_to_tree (TREE_TYPE (arg1), quo);
-
-  return NULL_TREE;
-}
-\f
 /* This is nonzero if we should defer warnings about undefined
    overflow.  This facility exists because these warnings are a
    special case.  The code to estimate loop iterations does not want