Opened 3 years ago

Last modified 8 months ago

#9137 new feature request

A way to match RULES only for literals

Reported by: nomeata Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.8.2
Keywords: Cc: Iceland_jack, erikd
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 (last modified by nomeata)

In GHC/Enum we have

"enumDeltaToInteger1"   [0] forall c n x . enumDeltaToIntegerFB c n x 1 = up_fb c n x 1
-- This rule ensures that in the common case (delta = 1), we do not do the check here,
-- and also that we have the chance to inline up_fb, which would allow the constructor to be
-- inlined and good things to happen.
-- We do not do it for Int this way because hand-tuned code already exists, and
-- the special case varies more from the general case, due to the issue of overflows.

This rule would be useful for all literals, not just for 1.

I remember a discussion that such a rule would be more useful if we had a way to specify that, for example (random syntax).

"enumDeltaToInteger1"   [0] forall c n x d . isLiteral d => enumDeltaToIntegerFB c n x d = up_fb c n x d

I’m reporting this now to be able to link to it from #9136, where this feature might also help.

Change History (4)

comment:1 Changed 3 years ago by nomeata

Description: modified (diff)

comment:2 Changed 2 years ago by thomie

Type of failure: None/UnknownRuntime performance bug

These tickets are related to runtime performance.

comment:3 Changed 9 months ago by Iceland_jack

Cc: Iceland_jack added

comment:4 Changed 8 months ago by erikd

Cc: erikd added
Note: See TracTickets for help on using tickets.