Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adinapoli/ghc-unoptimised-core-binds-repro
https://github.com/adinapoli/ghc-unoptimised-core-binds-repro
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/adinapoli/ghc-unoptimised-core-binds-repro
- Owner: adinapoli
- Created: 2020-09-09T13:15:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-09T13:16:05.000Z (over 4 years ago)
- Last Synced: 2024-10-15T06:52:45.568Z (3 months ago)
- Language: Haskell
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Overview
This is a small Cabal project demonstrating that is not possible to extract the 'CoreBind' with
optimisations turned off in case things like `UNPACK` are used. Here is the testing scenario:1. A "target" package that simply introduces a datatype with an unpacked field, and is
compiled with `-O2`.2. A 'ToyPlugin' GHC Plugin that modifies the GHC pipeline at the typechecking and core phases;
a. During typechecking, we disable optimisations (we call `updOptLevel 0` on the `DynFlags`)
and we call 'hscDesugar', hoping to get suitable binds;
b. During core, we print the "standard" binds associated to the optimisation level for the
user program (-O2).
c. We print the binds of both phases.One would expect that the generated Core to look something like that:
```
unFoo :: Foo -> Int
unFoo
= \ (ds_d3hC :: Foo) -> case ds_d3hC of { Foo ds_d3hD -> ds_d3hD }
```But we always get:
```
unFoo :: Foo -> Int
unFoo
= \ (ds_d3pn :: Foo) -> case ds_d3pn of { Foo dt_d3pS -> I# dt_d3pS }
```