Opened 18 months ago

Last modified 2 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:
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 (2)

comment:1 Changed 18 months ago by nomeata

  • Description modified (diff)

comment:2 Changed 2 months ago by thomie

  • Type of failure changed from None/Unknown to Runtime performance bug

These tickets are related to runtime performance.

Note: See TracTickets for help on using tickets.