Opened 3 years ago

Closed 3 years ago

#12378 closed bug (invalid)

Not enough inlining happens with single-method type classes

Reported by: akio Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: 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:

Description

In the attached file, GHC produces code (with -O2) for foo that references a top-level definition of type Small (Either () ()), despite the fact that all bindings in the module are marked INLINE.

If I use -DOTHER_METHOD to add another method to the class, this problem goes away. It looks like a ClassOp rule is helping here.

I'm not sure if this is a bug, but it was a surprising behavior for me, so I'm reporting it. Please feel free to close this ticket if it's the correct behavior.

Attachments (1)

test.hs (1.8 KB) - added by akio 3 years ago.
test case

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by akio

Attachment: test.hs added

test case

comment:1 Changed 3 years ago by simonpj

I've compiled your program with -O2, and both ghc 8.0 and HEAD, and cannot see a top-level definition of type Small (Either () ()).

Can you compile with -ddump-simpl, attach the result, and point to the line number that concerns you? Thanks!

Simon

comment:2 Changed 3 years ago by akio

Resolution: invalid
Status: newclosed

You are right, it looks like I used the wrong version of the compiler. With GHC 8.0 it works fine.

I'm closing the ticket now. I'm sorry for wasting your time.

Note: See TracTickets for help on using tickets.