Skip to content
Snippets Groups Projects
Commit 6434399b authored by Sebastian Graf's avatar Sebastian Graf
Browse files

Mark divModInt and friends as INLINE (#19267)

So that we don't get a silly worker `$wdivModInt` and risk inlining
`divModInt#` into `divModInt` or `$wdivModInt`, making both unlikely to
inline at call sites.

Fixes #19267.

There's a spurious metric increase in T12545. That seems entirely due to
shifts in Unique distribution (+5% more `IntMap.$winsert` calls).
The inappropriateness of the acceptance window is tracked in #19414.

Metric Increase:
    T12545
parent f78f001c
No related branches found
No related tags found
No related merge requests found
Pipeline #31741 failed
......@@ -1596,8 +1596,13 @@ getTag x = dataToTag# x
-- Definitions of the boxed PrimOps; these will be
-- used in the case of partial applications, etc.
-- See Note [INLINE division wrappers]
{-# INLINE quotInt #-}
{-# INLINE remInt #-}
{-# INLINE divInt #-}
{-# INLINE modInt #-}
{-# INLINE quotRemInt #-}
{-# INLINE divModInt #-}
quotInt, remInt, divInt, modInt :: Int -> Int -> Int
(I# x) `quotInt` (I# y) = I# (x `quotInt#` y)
......@@ -1625,6 +1630,17 @@ x# `divModInt#` y#
| otherwise =
x# `quotRemInt#` y#
{- Note [INLINE division wrappers]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Int division functions such as 'quotRemInt' and 'divModInt' have
been manually worker/wrappered, presumably because they construct
*nested* products.
We intend to preserve the exact worker/wrapper split, hence we mark
the wrappers INLINE (#19267). That makes sure the optimiser doesn't
accidentally inline the worker into the wrapper, undoing the manual
split again.
-}
-- Wrappers for the shift operations. The uncheckedShift# family are
-- undefined when the amount being shifted by is greater than the size
-- in bits of Int#, so these wrappers perform a check and return
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment