Opened 2 years ago

Closed 2 years ago

#13999 closed bug (invalid)

Simple function not inlined within declaration marked NOINLINE

Reported by: srb Owned by:
Priority: lowest Milestone:
Component: Compiler Version: 8.0.2
Keywords: Inlining Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This seems so shallow that I feel like I must be missing something, but if I implement a function like

eq :: Bool -> Bool -> Bool
eq x y = x == y
{-# NOINLINE eq #-}

the boolean equality operator is not inlined in eq, even at -O2. The generated core is instead

eq = $fEqBool_$c==

Change History (4)

comment:1 Changed 2 years ago by mpickering

Without the NOINLINE pragma the optimised definition is the same.

comment:2 Changed 2 years ago by srb

Well yes, but without NOINLINE it is likely that eq will be inlined in its caller, so delaying the inlining of (==) is arguably justifiable as a means to avoid excessive bloat.

comment:3 Changed 2 years ago by simonpj

What's the problem here? YOu get the same code whether or not eq is marked NOINLINE. GHC generally doesn't inline a function if the caller cannot benefit, which it can't here.

comment:4 Changed 2 years ago by srb

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.