Opened 7 weeks ago

Last modified 6 weeks ago

#15821 new task

Implement more constant folding for Naturals

Reported by: bgamari Owned by:
Priority: normal Milestone: 8.8.1
Component: Compiler Version: 8.6.1
Keywords: newcomer Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

#14465 has already gone a long way in improving the runtime performance of Natural numbers. However, we still lack constant folding for these numbers so there is money left on the table.

To fix this you will want to implement rules similar to those for Integer in the PrelRules module. Additionally, you will need to comment back in the CONSTANT_FOLDED pragmas in GHC.Natural (see Phab:D5267)

Change History (4)

comment:1 Changed 7 weeks ago by bgamari

Summary: Implement constant folding for NaturalsImplement more constant folding for Naturals

comment:2 Changed 7 weeks ago by bgamari

Additionally, working out why we fail to reduce the case in [T14465](https://phabricator.haskell.org/D5267#inline-41421) would be great.

comment:3 Changed 7 weeks ago by hsyl20

I'm currently resurrecting my work-in-progress on this topic. It's taking some time because I would like to make it generic enough that it would be easy to add new rules for Int8#, Int16# and the like when they will be merged in.

comment:4 Changed 6 weeks ago by martijnbastiaan

leonschool(@github) and I have been working on this when we discovered the missing foldings caused issues with the project we're working on. We've got a first implementation up: https://github.com/leonschoorl/ghc/commit/114981b040c8731702466246a0f7f6afb7874ac2 (don't mind the trace calls, WIP!).

@hsyl20, maybe we could work together?

Note: See TracTickets for help on using tickets.