20x slow down with -O or -O2
This program:
http://www.cse.unsw.edu.au/~dons/code/nobench/spectral/calendar/
Suffers a misoptimisation when compiled with -O or -O2. When compiled with -Onot:
serenity$ ghc -Onot --make -o calendar calendar.hs -no-recomp
[1 of 1] Compiling Main ( calendar.hs, calendar.o )
Linking calendar ...
serenity$ time ./calendar 1993 10000 > /dev/null
./calendar 1993 10000 > /dev/null 0.02s user 0.00s system 99% cpu 0.021 total
When compiled with -O:
serenity$ ghc -O --make -o calendar calendar.hs -no-recomp
[1 of 1] Compiling Main ( calendar.hs, calendar.o )
Linking calendar ...
serenity$ time ./calendar 1993 10000 > /dev/null
./calendar 1993 10000 > /dev/null 5.00s user 0.01s system 99% cpu 5.011 total
And with -O2:
serenity$ time ./calendar 1993 10000 > /dev/null
./calendar 1993 10000 > /dev/null 4.95s user 0.01s system 100% cpu 4.953 total
Reproduced in amd64 and x86 linux.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.6 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture | Multiple |